本文整理汇总了C#中AIState类的典型用法代码示例。如果您正苦于以下问题:C# AIState类的具体用法?C# AIState怎么用?C# AIState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AIState类属于命名空间,在下文中一共展示了AIState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsSatisfied
/// <summary>
/// Determines whether this instance is satisfied.
/// </summary>
/// <param name="state">The state of the AI.</param>
/// <returns></returns>
/// <exception cref="System.Exception">Invalid equality type in IntCondtion.IsSatisfied().</exception>
public override bool IsSatisfied(AIState state)
{
var value = state.GetInt(ID);
if (!value.HasValue)
{
return false;
}
switch (Equality)
{
case EqualityType.Equals:
return value == Value;
case EqualityType.NotEquals:
return value != Value;
case EqualityType.GreaterThan:
return value > Value;
case EqualityType.LessThan:
return value < Value;
case EqualityType.GreaterThanOrEqual:
return value >= Value;
case EqualityType.LessThanOrEqual:
return value <= Value;
default:
throw new Exception("Invalid equality type in IntCondtion.IsSatisfied().");
}
}
示例2: Collided
public override void Collided()
{
switch (State)
{
case AIState.Patrolling:
Target = Position;
break;
case AIState.Chasing:
Target = Position;
State = AIState.FollowingPath;
break;
case AIState.FollowingPath:
Target = Position;
regeneratePath = true;
break;
case AIState.Attacking:
Target = Position;
//if ((Target - Position).Length() > 100f)
//{
// Target = Position;
// State = AIState.FollowingPath;
// regeneratePath = true;
//}
break;
}
base.Collided();
}
示例3: Reset
public void Reset()
{
transform.position = m_Player.transform.position + (-m_Player.transform.forward * m_DistanceFromPlayer);
m_Activated = false;
m_IsMoving = false;
m_State = AIState.IDLE;
}
示例4: ChangeAIStateDelay
//couroutine change AI state with a delay time
IEnumerator ChangeAIStateDelay(AIState state, float time)
{
yield return new WaitForSeconds(time);
currentState = state;
iceChunkTimer = 1.0f;
StopCoroutine("ChangeAIStateDelay");
}
示例5: guard
public void guard()
{
releaseAI();
state = AIState.guard;
guardPos.parent = null;
ai.followTranform = guardPos;
}
示例6: releaseAI
public void releaseAI()
{
state = AIState.free;
guardPos.parent = transform;
guardPos.localPosition = Vector3.zero;
ai.followTranform = null;
}
示例7: Enemy
public Enemy(String aiName,
Vector2 position)
: base(position,
Vector2.Zero,
Vector2.Zero,
new Vector2(MAX_VELOCITY_X, MAX_VELOCITY_Y),
new Vector2(ACCELERATION_X, ACCELERATION_Y),
new Vector2(DECELERATION_X, DECELERATION_Y),
TextureManager.GetTexture(TextureNames.PLAYER_TWO_IDLE))
{
behaviour = new AIStateMachine(XMLFILE, aiName);
currentState = behaviour.GetCurrentState();
// These should be loaded from either XML
// or be statics in child-classes specific
// to types of AIs.
moveTime = new ParameterDouble();
moveTime.alpha = 500;
moveTime.beta = 500;
moveTime.distribution = Distribution.Normal;
// Temporary:
timeBetweenFire = new ParameterDouble();
timeBetweenFire.alpha = 1000;
timeBetweenFire.beta = 1000;
timeBetweenFire.distribution = Distribution.Normal;
}
示例8: Start
// Use this for initialization
void Start ()
{
initPos = transform.position;
anim = gameObject.GetComponent<Animation> ();
aiState = AIState.Idle;
}
示例9: AIStateMachine
/**
* Constructor for manually-initialized AISMs
**/
public AIStateMachine(String aiName, int numStates, AIState[] stateNames, double[][] tmatrix)
{
machineName = aiName;
rtransition = new Random();
StateNames = new List<AIState>(numStates);
TransitionMatrix = new Double[numStates][];
Initialize(numStates, stateNames, tmatrix);
}
示例10: SwitchState
/// <summary>
/// Forgets the old state and starts a new one.
/// </summary>
public void SwitchState(AIState state)
{
if (CurrentState != null)
stateStack.Pop().OnStop(actor);
stateStack.Push(state);
state.OnStart(actor);
}
示例11: AICohere
public AICohere(AIState state, Transform obj, float weight){
trans = obj;
go = new GameObject();
average = go.transform;
this.State = state;
this.Weight = weight;
Targets = new Transform[]{};
}
示例12: Awake
//init upon enabled, called faster than Start func
void Awake()
{
origPos = transform.position;
iceChunkArr = new GameObject[3];
currentState = AIState.state_Spawn_Self;
iceChunkTimer = 1.0f;
iceChunkPooler = transform.FindChild("iceChunkPooler");
}
示例13: Gateway
public Gateway(Game game, GraphicsDeviceManager graphics, Vector2 location)
: base(game, graphics, "content/gateway", true)
{
this.mLocation = location;
Random r = new Random();
mCurrentState = (AIState)r.Next(0, 2);
}
示例14: PuckCollision
public void PuckCollision()
{
if (state == AIState.Attack)
{
state = AIState.Defense;
thinkTimer = 0.0f;
}
}
示例15: Start
// Use this for initialization
void Start ()
{
initPos = transform.position;
anim = gameObject.GetComponent<Animation> ();
aiState = AIState.Idle;
anim["Jump1"].speed = 2;
anim["Jump2"].speed = 2;
anim["Jump3"].speed = 2;
}