private IEnumerator Shake() { shake.SetPosition(transform.localPosition); drift.Stop(); shake.Resume(); yield return(new WaitForSeconds(.1f)); shake.Stop(); // If not hitable then in drop state if (hitable) { drift.Resume(); } }
private void StopCar() { // Car exhaust off carExhaust.SetActive(false); drift.Stop(); carStopped = true; }
void Awake() { // Listen for game-triggered events Messenger.AddListener(GameEvent.P1_CUBE_HIT, P1CubeHit); Messenger.AddListener(GameEvent.P2_CUBE_HIT, P2CubeHit); Messenger.AddListener(GameEvent.P1_REX_DONE_MUNCHING, P1Reenable); Messenger.AddListener(GameEvent.P2_REX_DONE_MUNCHING, P2Reenable); Messenger.AddListener(GameEvent.REX_DEFEATED, RexDefeated); rigidBody = GetComponent <Rigidbody>(); LRDrift[] drifts = GetComponents <LRDrift>(); drift = drifts[0]; shake = drifts[1]; shake.Stop(); currentHealth = health; startPosition = transform.position; }