示例#1
0
 private void Attacking()
 {
     if (_attackTimer > 0)
     {
         if (_attackTimer <= AttackCooldown - AttackDuration)
         {
             Animator.SetBool("IsAttacking", false);
             Dagger.Active    = false;
             Dagger.WeaponHit = false;
         }
         else if (_attackTimer <= AttackCooldown - HitBoxDelay && !Dagger.WeaponHit)
         {
             Dagger.Active = true;
             if (_faceLeft)
             {
                 Dagger.GetComponent <BoxCollider2D>().offset = new Vector2(DAGGER_X_OFFSET_LEFT, DAGGER_Y_OFFSET);
             }
             else
             {
                 Dagger.GetComponent <BoxCollider2D>().offset = new Vector2(DAGGER_X_OFFSET_RIGHT, DAGGER_Y_OFFSET);
             }
         }
         else
         {
             Dagger.Active = false;
         }
     }
     else if (InputHelp.GetButtonDown(InputHelp.Buttons.Attack))
     {
         _attackTimer = AttackCooldown;
         Animator.SetBool("IsAttacking", true);
         SoundManager.PlaySingle(DaggerSound);
     }
 }
示例#2
0
        public override void HandleInput()
        {
            base.HandleInput();

            if (InputHelp.GetButtonDown(InputHelp.Buttons.Start))
            {
                PlayerModel.DialogCount += 1;
                if (PlayerModel.DialogCount == 4)
                {
                    Application.Quit();
                }
                ScreenManager.LoadScene("Desert");
            }
            if (InputHelp.AnyButtonDown())
            {
                Input.ResetInputAxes();
                _lineIndex += 1;
            }

            if (_lineIndex >= Lines.Count())
            {
                PlayerModel.DialogCount += 1;
                if (PlayerModel.DialogCount == 4)
                {
                    Application.Quit();
                }
                ScreenManager.LoadScene("Desert");
            }
        }
示例#3
0
        public override void HandleInput()
        {
            base.HandleInput();

            if (InputHelp.AnyButtonDown())
            {
                ScreenManager.LoadScene("Title");
            }
        }
示例#4
0
 public override void HandleInput()
 {
     if (InputHelp.AnyButtonDown())
     {
         InputHelp.ResetInputAxes();
         ExitScreen();
         Time.timeScale = 1;
     }
 }
示例#5
0
        public override void HandleInput()
        {
            base.HandleInput();

            Player.HandleInput();

            if (InputHelp.GetButtonDown(InputHelp.Buttons.Start))
            {
                ScreenManager.AddScreen(PauseScreen);
            }
        }
示例#6
0
        private float Jumping(Vector2 velocity)
        {
            if (InputHelp.GetButtonDown(InputHelp.Buttons.Jump) && _onGround)
            {
                velocity.y = JumpVelocity;
                SoundManager.PlaySingle(JumpSound);
                _jumpContinueTimer = MaxJumpContinue;

                Animator.SetBool("IsJumping", true);
                Animator.SetBool("IsStartOfJumpOver", false);
            }
            else if (_jumpContinueTimer > 0 && InputHelp.GetButton(InputHelp.Buttons.Jump))
            {
                velocity.y += JumpContinueVelocity * Time.deltaTime;
            }
            else
            {
                Animator.SetBool("IsStartOfJumpOver", true);
            }

            return(velocity.y);
        }
示例#7
0
        private float Moving()
        {
            float horVel;

            if (InputHelp.GetButton(InputHelp.Buttons.Left))
            {
                horVel    = -1;
                _faceLeft = true;
            }
            else if (InputHelp.GetButton(InputHelp.Buttons.Right))
            {
                horVel    = 1;
                _faceLeft = false;
            }
            else
            {
                horVel = 0;
            }

            Animator.SetFloat("Speed", Math.Abs(horVel));
            return(horVel);
        }
示例#8
0
        public override void HandleInput()
        {
            base.HandleInput();

            if (_inputTimer > 0)
            {
                _inputTimer = Mathf.Max(_inputTimer - Time.deltaTime, 0);
            }

            if (_inputTimer == 0 && InputHelp.GetButtonDown(InputHelp.Buttons.Left))
            {
                AdjustSelectedIndex(-1);
            }
            else if (_inputTimer == 0 && InputHelp.GetButtonDown(InputHelp.Buttons.Right))
            {
                AdjustSelectedIndex(1);
            }

            if (InputHelp.GetButtonDown(InputHelp.Buttons.Jump) || InputHelp.GetButtonDown(InputHelp.Buttons.Attack))
            {
                switch (_selectionIndex)
                {
                case 0:
                    PlayerModel.DialogCount = 1;
                    ScreenManager.LoadScene("Dialog");
                    ExitScreen();
                    break;

                case 1:
                    Application.Quit();
                    break;
                }
                SoundManager.PlayConfirm();
                InputHelp.ResetInputAxes();
            }
        }