void Update() { // Make sure there are enemies if (targets.HasEnemy == false) { targetReticle.SetActive(false); return; } // Position the target reticle targetReticle.SetActive(true); targetReticle.transform.position = targets.CurrentEnemy.EnemyTransform.position; targetReticle.transform.rotation = camera.rotation; distanceLabel.text = Vector3.Distance(transform.position, targets.CurrentEnemy.EnemyTransform.position).ToString("0.0"); enemyNameLabel.text = targets.CurrentEnemy.EnemyScript.DisplayName; enemyNumbersLabel.text = targets.AllEnemies.Count.ToString(); // Grab controls controlInput.x = CrossPlatformInputManager.GetAxis("Horizontal"); controlInput.y = CrossPlatformInputManager.GetAxis("Vertical"); if (FlightDirection == FlightMode.AwayFromTheTarget) { controlInput.x *= -1f; } IsRamming = CheckIfRamming(); Animate.SetFloat(HorizontalField, controlInput.x); Animate.SetFloat(VerticalField, controlInput.y); if (allowChangingTargets == true) { if ((CrossPlatformInputManager.GetButtonDown("NextTarget") == true) || (CrossPlatformInputManager.GetAxis("Xbox360ControllerTriggers") > 0.5f)) { targets.NextEnemy(); } else if ((CrossPlatformInputManager.GetButtonDown("PreviousTarget") == true) || (CrossPlatformInputManager.GetAxis("Xbox360ControllerTriggers") < -0.5f)) { targets.PreviousEnemy(); } } if (CrossPlatformInputManager.GetButtonUp("Pause") == true) { Singleton.Get <PauseMenu>().Show(); } // Figure out the direction to look at targetToShip = (targets.CurrentEnemy.EnemyTransform.position - transform.position); targetToShip.Normalize(); moveDirection = targetToShip; if (FlightDirection == FlightMode.AwayFromTheTarget) { moveDirection *= -1f; if ((Time.time - timeCollisionStarted) > reverseFor) { timeCollisionStarted = -1f; FlightDirection = FlightMode.ToTheTarget; } } lookRotation = Quaternion.LookRotation(moveDirection); if ((pauseStartedRealTime > 0) && ((Time.unscaledTime - pauseStartedRealTime) > pauseFor)) { Time.timeScale = 1; pauseStartedRealTime = -1f; } }