当前位置: 首页>>代码示例>>C#>>正文


C# AIState类代码示例

本文整理汇总了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().");
            }
        }
开发者ID:JustinHughart,项目名称:LevvionAI,代码行数:33,代码来源:IntCondition.cs

示例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();
        }
开发者ID:GarethIW,项目名称:Hunted,代码行数:28,代码来源:AIDude.cs

示例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;
 }
开发者ID:jtabG,项目名称:Alone,代码行数:7,代码来源:AIRunnerBehaviour.cs

示例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");
 }
开发者ID:lamweilun,项目名称:FINAL_YEAR_PROJECT_MAJOR_CNB,代码行数:8,代码来源:IceBossBehaviour.cs

示例5: guard

 public void guard()
 {
     releaseAI();
     state = AIState.guard;
     guardPos.parent = null;
     ai.followTranform = guardPos;
 }
开发者ID:Seraphli,项目名称:TheInsectersWar,代码行数:7,代码来源:AICommand.cs

示例6: releaseAI

 public void releaseAI()
 {
     state = AIState.free;
     guardPos.parent = transform;
     guardPos.localPosition = Vector3.zero;
     ai.followTranform = null;
 }
开发者ID:Seraphli,项目名称:TheInsectersWar,代码行数:7,代码来源:AICommand.cs

示例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;
   }
开发者ID:FranciscoCanas,项目名称:Crash.net,代码行数:27,代码来源:Enemy.cs

示例8: Start

	// Use this for initialization
	void Start ()
	{
		initPos = transform.position;
		anim = gameObject.GetComponent<Animation> ();
		aiState = AIState.Idle;

	}
开发者ID:ErwinPS,项目名称:FreekickABC,代码行数:8,代码来源:GoalKeeperAI.cs

示例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);
 }
开发者ID:FranciscoCanas,项目名称:AIStateMachine,代码行数:11,代码来源:AIStateMachine.cs

示例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);
    }
开发者ID:AkiV,项目名称:Survival,代码行数:11,代码来源:StateMachine.cs

示例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[]{};
	}
开发者ID:paulaluri,项目名称:CMU-15-666,代码行数:8,代码来源:AICohere.cs

示例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");
 }
开发者ID:lamweilun,项目名称:FINAL_YEAR_PROJECT_MAJOR_CNB,代码行数:9,代码来源:IceBossBehaviour.cs

示例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);
        }
开发者ID:IainCargill,项目名称:froggerxna,代码行数:8,代码来源:Gateway.cs

示例14: PuckCollision

 public void PuckCollision()
 {
     if (state == AIState.Attack)
     {
         state = AIState.Defense;
         thinkTimer = 0.0f;
     }
 }
开发者ID:robert-porter,项目名称:AirHockey,代码行数:8,代码来源:AI.cs

示例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;
	}
开发者ID:ErwinPS,项目名称:FreekickABC,代码行数:10,代码来源:OpponentBlockerAI.cs


注:本文中的AIState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。