Exemplo n.º 1
0
        public void Update()
        {
            this._inputState = GetInputFromPool();

            if (this._inputState.Right)
            {
                this._command = new CharacterCommandMoveRight();
            }
            else if (this._inputState.Left)
            {
                this._command = new CharacterCommandMoveLeft();
            }
            else if (this._inputState.Up)
            {
                this._command = new CharacterCommandMoveUp();
            }
            else if (this._inputState.Down)
            {
                this._command = new CharacterCommandMoveDown();
            }
            else if (this._inputState.A)
            {
                this._command = new CharacterCommandBasicAttack();
            }
            else
            {
                this._command = null;//not user command
            }
        }
Exemplo n.º 2
0
        public void Update()
        {
            //this._inputState = GetInputFromPool();

            //if (!this._inputState.HasInput())
            //{
            //    this._command = new CharacterCommandIdle();
            //}
            if (this._inputState.Right)
            {
                this._command = new CharacterCommandMoveRight();
            }
            else if (this._inputState.Left)
            {
                this._command = new CharacterCommandMoveLeft();
            }
            else if (this._inputState.Up)
            {
                this._command = new CharacterCommandMoveUp();
            }
            else if (this._inputState.Down)
            {
                this._command = new CharacterCommandMoveDown();
            }
            else if (this._inputState.A)
            {
                this._command = new CharacterCommandBasicAttack();
            }
            //else
            //    throw new Exception("No command");
        }