// ====================================================================================== override public float GetHorizontal() { return(IsActive() ? InputMgr.GetAxis((int)m_nbPlayer, InputMgr.eAxis.HORIZONTAL) : 0f); }
// ====================================================================================== override public float GetVertical() { return(IsActive() ? InputMgr.GetAxis((int)m_nbPlayer, InputMgr.eAxis.VERTICAL) : 0f); }
// ====================================================================================== public void Update() { #if UNITY_EDITOR m_useAnimation = m_animator != null; if (!Application.isPlaying) { return; } #endif if (GameMgr.IsGameOver) { return; } float horizontal = 0, vertical = 0; bool doJump = false, doDash = false; if (!isStunned) { // get input horizontal = InputMgr.GetAxis((int)m_player, InputMgr.eAxis.HORIZONTAL); //Input.GetAxis("Horizontal"); vertical = InputMgr.GetAxis((int)m_player, InputMgr.eAxis.VERTICAL); //Input.GetAxis("Vertical"); doJump = InputMgr.GetButton((int)m_player, InputMgr.eButton.JUMP); //Input.GetButtonDown("Jump"); doDash = InputMgr.GetButton((int)m_player, InputMgr.eButton.DASH); //Input.GetButtonDown("Dash"); // get pick up item input if (InputMgr.GetButton((int)m_player, InputMgr.eButton.GRAB) && !grabButtonPressed) { if (WeaponList.Count > 0) { PickupWeapon(); } } grabButtonPressed = InputMgr.GetButton((int)m_player, InputMgr.eButton.GRAB); // get throw item input if (InputMgr.GetButton((int)m_player, InputMgr.eButton.TOSS)) { if (EquippedWeapon != WeaponPickup.WeaponType.FISTS) { ThrowWeapon(); } } // get attack input if (InputMgr.GetButton((int)m_player, InputMgr.eButton.ATTACK) && !isAttacking) { isAttacking = true; switch (EquippedWeapon) { case WeaponPickup.WeaponType.FISTS: PunchAttack(); break; case WeaponPickup.WeaponType.SABER: SaberAttack(); break; case WeaponPickup.WeaponType.PISTOL: PistolAttack(); break; } } } // update position UpdateTransform(horizontal, vertical, doJump, doDash); // OBS: UptadeAnimator MAYBE is OUT OF DATE!!!! // TODO: Test with anims and update if necessary if (m_useAnimation) { m_animator.SetState(m_state); m_animator.SetDirection(m_direction); } }