void onThingCollected(object o, EventArgs args) { Debug.Log("thingcollected"); ThingScript thingScript = (ThingScript)o; if (thingScript.thing.final) { changeMoney(thingScript.thing.worth); } thingScript.collected -= onThingCollected; }
void onThingSpawn(object o, EventArgs <ThingScript> args) { Debug.Log("thingspawn"); ThingScript thingScript = args.value; Thing thing = thingScript.thing; if (!thing.final) { thingScript.broke += onThingBroke; // i guess i can use the sender for somthing here... } thingScript.collected += onThingCollected; }