public void OnTriggerEnter(Collider col) { if (col.GetComponentInParent <ShipPhysicsController>()) // If it's a ship { ShipPhysicsController ship = col.GetComponentInParent <ShipPhysicsController>(); GetComponent <AudioSource>().Play(); ship.GetComponentInParent <ShipSoundManager>().OnBoost(); ship.GetComponentInChildren <Animator>().SetTrigger("Boosting"); ParticleSystem boostEffect = ship.transform.FindChild("BoostEffect").GetComponentInChildren <ParticleSystem>(); boostEffect.loop = false; boostEffect.time = 0; boostEffect.Play(); ship.ApplyBoost(boost, transform.forward); } }
void OnTriggerEnter(Collider col) { ShipPhysicsController ship = col.GetComponentInParent <ShipPhysicsController>(); EnemyInputController enemy = col.GetComponentInParent <EnemyInputController>(); PlayerInputController player = col.GetComponentInParent <PlayerInputController>(); if (ship) { ship.OnGoalPassed(); } if (enemy) { enemy.OnGoalPassed(); } if (player) { player.OnGoalPassed(); GameObject.Find("GameFlowController").GetComponent <GameFlowController>(). SetState(GameFlowController.State.RaceFinished); } }
public void Start() { shipPhysicsController = GetComponent <ShipPhysicsController>(); rb = shipPhysicsController.GetRigidbody(); weaponController = GetComponent <WeaponController>(); }
void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <ShipPhysicsController>(); }