void Update() { if (Health > 0) { CheckState(); switch (EnemyState) { case States.Idle: break; case States.Attack: SetRotation(); rigi.AddRelativeForce(0, 0, Speed * Time.deltaTime, ForceMode.Force); Gun.Attack(); break; case States.Escape: SetRotation(Player.rotation); rigi.AddRelativeForce(0, 0, Speed * Time.deltaTime, ForceMode.Force); break; } } else { GameManager.Instance.AddEnemyDawn(); Explode(); } }
private void Update() { if (Health <= 0) { CameraManager.Instance.SwitchToExplosionCamera(transform.position); Explode(); GameManager.Instance.GameOver(); } else { GetInput(ref InputPitch, ref InputRoll, ref InputYaw, ref Throttle); transform.Rotate(InputPitch * PitchRate * Time.deltaTime, InputYaw * YawRate * Time.deltaTime, InputRoll * RollRate * Time.deltaTime, Space.Self); Gun.Attack(); FuelTimer += Time.deltaTime; if (FuelTimer > 1) { FuelTimer = 0; Fuel--; } Debug.Log(Fuel); } }