void Update() { if (instance == null) { GameModeManagerBase.SetManagerInstance(ref instance); } if (instance.mState == GameModeManagerBase.State.Paused) { return; } string fireButton = ""; if (player.name == "Player 1") { fireButton = "Fire1"; } if (player.name == "Player 2") { fireButton = "Fire2"; } if (Input.GetButton(fireButton) && Time.time > nextFire) { nextFire = Time.time + fireRate; GameObject clone = instance.GetBulletSpawner() .Spawn(shotSpawn.position, shotSpawn.rotation, player); rb = clone.GetComponent <Rigidbody>(); rb.velocity = clone.transform.forward * bulletSpeed; } }
void FixedUpdate() { float horizontalInput = 0.0f; float forwardVelocity = 0.0f; if (instance == null) { GameModeManagerBase.SetManagerInstance(ref instance); } if (instance.mState == GameModeManagerBase.State.Paused) { return; } if (name == "Player 1") { horizontalInput = Input.GetAxis("Horizontal_p1"); forwardVelocity = Input.GetAxisRaw("Vertical_p1"); } if (name == "Player 2") { horizontalInput = Input.GetAxis("Horizontal_p2"); forwardVelocity = Input.GetAxisRaw("Vertical_p2"); } transform.RotateAround(transform.position, transform.up, horizontalInput * TurnSpeed); mBody.velocity += (transform.forward * Mathf.Clamp(forwardVelocity, 0.0f, 1.0f) * Speed); mBody.velocity = new Vector3( Mathf.Clamp(mBody.velocity.x, -maxVelocity, maxVelocity), 0.0f, Mathf.Clamp(mBody.velocity.z, -maxVelocity, maxVelocity)); }
void FixedUpdate() { if (instance == null) { GameModeManagerBase.SetManagerInstance(ref instance); } if (instance.mState != GameModeManagerBase.State.Paused) { rb.MoveRotation(rb.rotation * deltaRotation); } }
void Update() { if (instance == null) { GameModeManagerBase.SetManagerInstance(ref instance); PlayerOne = instance.GetPlayerOne(); PlayerTwo = instance.GetPlayerTwo(); } if (instance.mState == GameModeManagerBase.State.Playing) { AimAndFire(); } }
void Update() { if (instance == null) { GameModeManagerBase.SetManagerInstance(ref instance); } //Needs to be changed to the base class if (instance.mState == GameModeManagerBase.State.Paused) { return; } ApplyThrustEffect(); }
void Awake() { GameModeManagerBase.SetManagerInstance(ref instance); player = transform.root.gameObject; }