Exemple #1
0
 //State Related Methods////////////////////
 public void SetState(Type state)
 {
     if (_currentState.GetType() == state)
     {
         return;
     }
     Debug.Log("Enemy Changing from: " + _currentState.GetType() + " to: " + state);
     _currentState.EndState();
     _currentState = _states[state];
     _currentState.BeginState();
 }
Exemple #2
0
        public override void Start()
        {
            //Basics///////////////////////////////
            base.Start();
            Position    = CurrentNode.Position;
            _EnemyStats = GetComponent <EnemyStats>();
            //Setting up the Cache/////////////////
            _states = new Dictionary <Type, EnemyStateBase>();

            _states.Add(typeof(EnemyStateWalking), new EnemyStateWalking(this));
            _states.Add(typeof(EnemyStateInteractionPlayer), new EnemyStateInteractionPlayer(this));
            _states.Add(typeof(EnemyStateIdle), new EnemyStateIdle(this));

            //Starting First State Manually////////
            _currentState = _states[typeof(EnemyStateIdle)];
            _currentState.BeginState();
        }