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); } }
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"); } }
public override void HandleInput() { base.HandleInput(); Player.HandleInput(); if (InputHelp.GetButtonDown(InputHelp.Buttons.Start)) { ScreenManager.AddScreen(PauseScreen); } }
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); }
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(); } }