// this knows for sure that it gets the right event type. void CeilingOff(CeilingOffEventInfo ceilingOffEventInfo) { Debug.Log("Recieved Event On Listener: " + gameObject.name); Debug.Log("Event Description: " + ceilingOffEventInfo.EventDescription); // do things Ceiling.SetActive(false); }
//void Update() //{ // if (Input.GetKeyDown(KeyCode.D)) // { // Die(); // } //} // void Die() public void CeilingOff() { // get a new instance of the death info to pass into the event. //UnitDeathEventInfo udei = new UnitDeathEventInfo(); //udei.EventDescription = "Unit " + gameObject.name + " has died."; //udei.DeadUnitGO = gameObject; CeilingOffEventInfo coi = new CeilingOffEventInfo(); coi.EventDescription = "Button Was Pressed to Turn the Ceiling Off"; //coi.ModParent = gameObject; // udei tells you what kind of event that it is and has all of the data associated. EventSystem.Current.FireEvent( coi ); //Destroy(gameObject); }