// 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); } }
// Send a value to all assigned unlockable objects public void sendValueToAll() { for (int i = 0; i < objects.Length; i++) { ComboUnlockable script = objects[i].GetComponent <ComboUnlockable>(); if (script != null) { script.Add(value); } } }