void StateChange(bool active) { foreach (GameObject activateable in activates) { if (activateable != null) { activate activateScript = activateable.GetComponent <activate>(); activateScript.Activate(active); // don't need to send a signal to change the right variable if (overcharge) { activateScript.Overcharge(charged); } } } }
void StateChange(bool active) { //AkSoundEngine.PostEvent("ButtonPress" , gameObject); foreach (GameObject activateable in activates) { if (activateable != null) { activate activateScript = activateable.GetComponent <activate>(); activateScript.Activate(activated); if (overcharge) { activateScript.Overcharge(overcharge); // if the power station is overcharged, overcharge the activatable dependent object } } } }
void OnTriggerEnter2D(Collider2D col) { if (col.tag == "Player") { foreach (GameObject activateable in activates) { if (activateable != null) { activate activateScript = activateable.GetComponent <activate>(); activateScript.Activate(true); if (overcharge) { activateScript.Overcharge(overcharge); // if the power station is overcharged, overcharge the activatable dependent object } } } Destroy(gameObject); } }
void StateChange(bool active) { AkSoundEngine.PostEvent("ButtonPress", gameObject); foreach (GameObject activateable in activates) { if (activateable != null) { activate activateScript = activateable.GetComponent <activate>(); activateScript.Activate(active); if (!activated && switchRight) { activateScript.ActivateDirection(!right); } else { activateScript.ActivateDirection(right); } if (overcharger) { activateScript.Overcharge(active); // if the button is active, overcharge the activatable dependent object } } } }