Ejemplo n.º 1
0
        public void Update_State()
        {
            this._timeDelta += Time.deltaTime;

            switch (this._state_current)
            {
            case eState.Init:
            {
                _state_used = false;                         //init
                this.SetState(eState.Before);

                //_behavior = _skillBook [CounterBlockSting.Battle.eSkillKind.Attack_1].ElementAt(0);
            }
            break;

            case eState.Before:
            {
                if (_behavior.time_before <= this._timeDelta)
                {
                    this.SetState(eState.After);
                }
            }
            break;

            case eState.After:
            {
                if (_behavior.time_after <= this._timeDelta)
                {
                    this.SetState(eState.Init);
                }
            }
            break;

            case eState.Attack_Init:
            {
                _state_used = false;                         //init
                this.SetState(eState.Attack_Before);

                _behavior = _skillBook [CounterBlockSting.eSkillKind.Attack_1].ElementAt(0);
            }
            break;

            case eState.Attack_Before:
            {
                //if (_time_before.attack <= this._timeDelta)
                if (_behavior.time_before <= this._timeDelta)
                {
                    this.SetState(eState.Attack_After);
                }
            }
            break;

            case eState.Attack_After:
            {
                //if (_time_after.attack <= this._timeDelta)
                if (_behavior.time_after <= this._timeDelta)
                {
                    this.SetState(_state_next);
                    _state_next = eState.Idle;
                }
            }
            break;

            case eState.Block_Init:
            {
                _state_used = false;                         //init
                this.SetState(eState.Block_Before);

                _behavior = _skillBook [CounterBlockSting.eSkillKind.Block_1].ElementAt(0);
            }
            break;

            case eState.Block_Before:
            {
                //if (_time_before.block <= this._timeDelta)
                if (_behavior.time_before <= this._timeDelta)
                {
                    this.SetState(eState.Block_After);
                }
            }
            break;

            case eState.Block_After:
            {
                //if (_time_after.block <= this._timeDelta)
                if (_behavior.time_after <= this._timeDelta)
                {
                    this.SetState(_state_next);
                    _state_next = eState.Idle;
                }
            }
            break;

            case eState.Idle:
            case eState.Hit:
            case eState.None:
            {
                _state_used = false;                         //init

                //default loop
                //if (_time_before.idle <= this._timeDelta)
                if (_behavior.time_before <= this._timeDelta)
                {
                    this.SetState(eState.Idle);
                }

                //다음 상태가 있을 경우
                if (eState.Idle != _state_next)
                {
                    this.SetState(_state_next);
                    _state_next = eState.Idle;
                }
            }
            break;
            }
        } //end func
Ejemplo n.º 2
0
 public void SetBehavior(CounterBlockSting.eSkillKind kind, int sequence)
 {
     _behavior = _skillBook [kind].ElementAt(sequence);
 }