void Update() { if (animator && Camera.main) { JoystickToEvents.Do(transform, Camera.main.transform, ref speed, ref direction); locomotion.Do(speed * 6, direction * 180); } }
void Update() { if (animator && Camera.main) { if (transform.tag == "Player") { JoystickToEvents.Do(transform, Camera.main.transform, ref speed, ref direction); locomotion.Do(speed * 6, direction * 180); if (Input.GetButtonDown("Fire1")) { movement.canMove = false; aimShadow.SetActive(true); } if (Input.GetButtonUp("Fire1") && canCastAbility1) { canShoot = false; locomotion.Attack(1); StartCoroutine(WaitToUseAbility(ability1WaitTime, ability1)); StartCoroutine(CancelAnim(1, cancelAnimAt1)); // StartCoroutine(ShootArrow()); StartCoroutine(AbilityCooldown(ability1Cooldown, 1)); } if (Input.GetButtonDown("Fire2") && canCastAbility3) { locomotion.Attack(3); if (ability3 != null) { StartCoroutine(WaitToUseAbility(ability3WaitTime, ability3)); movement.canMove = false; StartCoroutine(AbilityLifeTime(abilityLifetime3, ability3)); StartCoroutine(AbilityCooldown(ability1Cooldown, 3)); } StartCoroutine(CancelAnim(3, cancelAnimAt3)); } if (Input.GetButtonDown("Fire3")) { movement.canMove = false; aimShadow.SetActive(true); } if (Input.GetButtonUp("Fire3") && canCastAbility2) { canShoot = false; locomotion.Attack(1); StartCoroutine(WaitToUseAbility(ability2WaitTime, ability2)); StartCoroutine(CancelAnim(1, cancelAnimAt1)); //StartCoroutine(ShootArrow()); StartCoroutine(AbilityCooldown(ability1Cooldown, 2)); } } } }
private void Update() { if (mAnimator && Camera.main) { JoystickToEvents.Do(transform, Camera.main.transform, out mSpeed, out mDirection); // mLocomotion.Do(mSpeed * 6, mDirection * 180); mLocomotion.Do(mSpeed * 6, mDirection); } }
void Update() { if (animator && Camera.main) { JoystickToEvents.Do(transform, Camera.main.transform, ref speed, ref direction); locomotion.Do(this.gameObject, speed * 10, direction * 180); } { #if !MOBILE_INPUT // Create a ray from the mouse cursor on screen in the direction of the camera.0 Ray camRay = Camera.main.ScreenPointToRay(Input.mousePosition); // Create a RaycastHit variable to store information about what was hit by the ray. RaycastHit floorHit; // Perform the raycast and if it hits something on the floor layer... if (Physics.Raycast(camRay, out floorHit, camRayLength, floorMask)) { // Create a vector from the player to the point on the floor the raycast from the mouse hit. Vector3 playerToMouse = floorHit.point - transform.position; // Ensure the vector is entirely along the floor plane. playerToMouse.y = 0f; // Create a quaternion (rotation) based on looking down the vector from the player to the mouse. Quaternion newRotatation = Quaternion.LookRotation(playerToMouse); // Set the player's rotation to this new rotation. this.transform.rotation = newRotatation; //playerRigidbody.MoveRotation(newRotatation); } #else Vector3 turnDir = new Vector3(CrossPlatformInputManager.GetAxisRaw("Mouse X"), 0f, CrossPlatformInputManager.GetAxisRaw("Mouse Y")); if (turnDir != Vector3.zero) { // Create a vector from the player to the point on the floor the raycast from the mouse hit. Vector3 playerToMouse = (transform.position + turnDir) - transform.position; // Ensure the vector is entirely along the floor plane. playerToMouse.y = 0f; // Create a quaternion (rotation) based on looking down the vector from the player to the mouse. Quaternion newRotatation = Quaternion.LookRotation(playerToMouse); // Set the player's rotation to this new rotation. this.transform.rotation = newRotatation; } #endif } }
void Update() { if (animator && Camera.main) { if (transform.tag == "Player1") { player_num = 1; } else if (transform.tag == "Player2") { player_num = 2; } JoystickToEvents.Do(transform, Camera.main.transform, ref speed, ref direction, player_num); locomotion.Do(speed * 6, direction * 180); } }
void Update() { if (animator && Camera.main) { JoystickToEvents.Do(transform, Camera.main.transform, ref speed, ref direction); //locomotion.Do(speed * 6, direction * 180); locomotion.Do(speed * speed_val, direction * 180); animator.speed = speed_val2; //(xx f = 10.0f ���j // ���٣� AnimatorStateInfo state = animator.GetCurrentAnimatorStateInfo(0); bool inWalkRun = state.IsName("Locomotion.WalkRun"); if (inWalkRun) { transform.position += transform.TransformDirection(Vector3.forward * speed / 10); } } }