void Update() { if (!doingGroundPound) { if (!IsLeftJoystickInput()) { animationController.ChangeAnimation(Constants.ANIMATION_IDLE); particleController.StopFeetDust(); } else { float angle = (Mathf.Atan2(-Input.GetAxis(XboxController.leftJoystickX), -Input.GetAxis(XboxController.leftJoystickY)) * Mathf.Rad2Deg) + 45f; transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(new Vector3(0f, -angle, 0)), rotationSpeed * Time.deltaTime); if (!shooting) { animationController.ChangeAnimation(Constants.ANIMATION_RUN); } if (!particleController.feetDust.isPlaying && collisionController.onGround) { particleController.PlayFeetDust(); } } transform.position += isometricForward * Time.deltaTime * movementSpeed * -Input.GetAxis(XboxController.leftJoystickY); transform.position += isometricRight * Time.deltaTime * movementSpeed * Input.GetAxis(XboxController.leftJoystickX); //transform.position += isometricForward * Time.deltaTime * movementSpeed * Input.GetAxis("Vertical"); //transform.position += isometricRight * Time.deltaTime * movementSpeed * Input.GetAxis("Horizontal"); } if (Input.GetButtonDown(XboxController.xboxAButton)) { Jump(); } if (Input.GetButtonDown(XboxController.xboxXButton) && canGroundPound) { StartCoroutine(GroundPound()); } if (Input.GetButtonDown(XboxController.xboxBButton)) { uiController.SetDynamiteIcon(false); weaponsController.DropDynamite(); } if (Input.GetAxis(XboxController.rightTrigger) >= 1f) { shooting = true; weaponsController.Shoot(); movementSpeed = 0f; animationController.ChangeAnimation(Constants.ANIMATION_IDLE); } else { shooting = false; movementSpeed = originalMovementSpeed; } }
void Start() { animationController = GetComponent <AnimationController>(); collisionController = GetComponent <PlayerCollisionController>(); particleController = GetComponent <PlayerParticleController>(); weaponsController = GetComponent <PlayerWeaponsController>(); uiController = GetComponent <PlayerUIController>(); rb = GetComponent <Rigidbody>(); animationController.ChangeAnimation(Constants.ANIMATION_IDLE); originalMovementSpeed = movementSpeed; }