Beispiel #1
0
        public override void Run(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Vector2 eventScrollValue)
        {
            //Check if the flag for win is set
            WinCond.Run(gameTime, eventScrollValue);

            if (WinCond.IsEnded)
            {
                TGPAContext.Instance.EndLevel(true);
                this.IsEnded = true;
            }
            else
            {
                //Check for defeat
                LoseCond.Run(gameTime, eventScrollValue);

                if (LoseCond.IsEnded)
                {
                    TGPAContext.Instance.EndLevel(false);
                    this.IsEnded = true;
                }
            }

            //P1 (and P2) are dead
            bool lose = false;

            if (TGPAContext.Instance.Map.Flags.GetFlag("player1die"))
            {
                if (TGPAContext.Instance.Player2 != null)
                {
                    if (TGPAContext.Instance.Map.Flags.GetFlag("player2die"))
                    {
                        lose = true;
                    }
                }
                else
                {
                    lose = true;
                }
            }

            if (lose)
            {
                TGPAContext.Instance.Map.Flags.SetFlag("playersdie");
                MusicEngine.Instance.StopMusic();
            }
        }
Beispiel #2
0
 public void RgisterHeandler(WinCond del)
 {
     _del = del;
 }