public void Affect(bool AddHealth, float Value) { if (AddHealth) { HP.AddHealth(Value); } else { HP.SubtractHealth(Value); } }
// Repair the building public void Repair() { if (!IsRepairable(GameObject.FindGameObjectWithTag("Human").GetComponent <Player>().GetNumCoins())) { return; } GameObject.FindGameObjectWithTag("Human").GetComponent <Player>().SpendCoins((int)repairCost); health.AddHealth(repairQuantity); NotifyHUD(); ApplyMainTexture(); ApplySmokeEffect(); if (!repair.isPlaying) { repair.PlayOneShot(repair.clip); } }