private void Update() { //If the game is paused, we want to skip the update loop if (Time.timeScale <= 0f) { return; } DecayTimer -= Time.deltaTime; if (DecayTimer <= 0f) { DecayTimer = DecayCountdown; DecayState -= DecayStepAmount; if (DecayState <= 0f) { tankDirtiness.AddDirtiness(Dirtiness); for (int x = this.transform.childCount - 1; x >= 0; x--) { Destroy(this.transform.GetChild(x).gameObject); } Destroy(this.gameObject); } else { //position = new Tuple<Vector3, Quaternion>(transform.position, transform.rotation); //segmentPositions = segments.Select(s => new Tuple<Vector3, Quaternion>(s.transform.position, s.transform.rotation)).ToList(); } } }
public override void BeforeDestroying(Decayable item) { base.BeforeDestroying(item); tankDirtiness.AddDirtiness((item as Food).Dirtiness); }