// Remove value from the assigned unlockable object public void removeValue(GameObject obj) { ComboUnlockable script = obj.GetComponent <ComboUnlockable>(); if (script != null) { script.Subtract(value); } }
// Each object sends a value to the "unlockable" object, which will perform // an action when its total value reaches over its assigned threshold // Send a value to the assigned unlockable object public void sendValue(GameObject obj) { ComboUnlockable script = obj.GetComponent <ComboUnlockable>(); if (script != null) { script.Add(value); } }
// Remove value from all assigned unlockable objects public void removeValueToAll() { for (int i = 0; i < objects.Length; i++) { ComboUnlockable script = objects[i].GetComponent <ComboUnlockable>(); if (script != null) { script.Subtract(value); } } }