public void DoAction() { Splittable cube = gameObject.GetComponent <Splittable> (); if (cube) { cube.Split(); } Spawner spawn = gameObject.GetComponent <Spawner> (); if (spawn) { spawn.Spawn(); } Sweeper sweep = gameObject.GetComponent <Sweeper> (); if (sweep) { sweep.Sweep(); } Shotgun shotgun = gameObject.GetComponent <Shotgun> (); if (shotgun) { shotgun.Shoot(); } }
public void PlayerDeath() { source.Play(); isGameActive = false; lives--; livesCounter.text = "Lives: " + lives; player.transform.position = offScreen; sweeper.Sweep(); timeOfDeath = Time.time; }