當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。