public void SubscribeToHandler(EventManager em) { //em.PlaySound += new EventManager.SoundEventHandler(EventFired); // lambda expression em.PlaySound += (sender, firedEvent) => { senders.Add(sender); eventArgs.Add(firedEvent); }; }
/// <summary> /// Constructor. /// </summary> public GameplayScreen(Game game) : base(game) { mGame = (MainGameClass)game; mGame.MainCamera.InitializeView(640,480,0,0); TransitionOnTime = TimeSpan.FromSeconds(1.5); TransitionOffTime = TimeSpan.FromSeconds(0.5); eventManager = new EventManager(); soundManager = new SoundManager(); aiManager = new AIManager(); sceneManager = new SceneManager(); soundManager.SubscribeToHandler(eventManager); eventManager.FireSoundEvent(new Player(), new SoundEventArgs(1.0, 1)); }