//a method to collect resources. public void CollectResources(int generatorID) { generators[generatorID].OnResourceCollected(building.FactionID); //collect the resources and reset the generator's settings if (RTSHelper.IsLocalPlayer(building)) //if this is the local player: { CustomEvents.OnResourceGeneratorCollected(this, generatorID); //trigger custom event AudioManager.Play(gameMgr.GetGeneralAudioSource(), collectionAudio, false); //plau the collection audio } }