Ejemplo n.º 1
0
        public override void OnBackPress()
        {
            PauseScreen s = new PauseScreen();

            s.Initialize(Content);
            ScreenManager.Get.AddScreen(s);
        }
Ejemplo n.º 2
0
        public override void ProcessEvent(Jabber.Util.Event ev)
        {
            if (!IsTopScreen)
            {
                return;
            }
            if (ev is ExplosionEvent)
            {
                ExplosionPlayed = true;
            }
            if (!ExplosionPlayed)
            {
                /*
                if (ev is BreakableDestroyed && !(ev is BreakableHit))
                {
                    if (!SFXPlayed((ev as BreakableDestroyed).Broken))
                    {
                       // if (SFXTime((ev as BreakableDestroyed).Broken) <= 0)
                        {
                            BreakableBody.PlaySFXBreakForMaterial((ev as BreakableDestroyed).Broken);
                            SFXPlayed((ev as BreakableDestroyed).Broken, true);
                        }
                    }
                    else
                    {
                        int k = 0;
                    }
                }
                else if (ev is BreakableHit)
                {
                    if (!SFXPlayed((ev as BreakableHit).Broken))
                    {
                        if (SFXTime((ev as BreakableHit).Broken) <= 0.0f)
                        {
                            BreakableBody.PlayHitSFXForMaterial((ev as BreakableHit).Broken);
                            SFXPlayed((ev as BreakableHit).Broken, true);
                        }
                    }
                }*/
            }
            if (ev is CannonFireEvent && scene.ToFire.Count > 0)
            {
                CannonFireEvent e = ev as CannonFireEvent;

                Vector2 dir = e.Dir;
                Chicken chick = null;// new Chicken_Dash(world);

                switch (scene.ToFire[scene.ToFire.Count - 1])
                {
                    case 0:
                        chick = new Chicken(scene);
                        break;
                    case 1:
                        chick = new Chicken_Dash(scene);
                        break;
                    case 2:
                        chick = new Chicken_Egg(scene);
                        break;
                    case 3:
                        chick = new Chicken_Explode(scene);
                        break;
                    case 4:
                        chick = new Chicken_Mini_Launcher(scene);
                        break;
                }

                chick.Initialize(Content);
                chick.Position = e.Position;
                chick.Body.LinearVelocity = dir;
                withChicks.AddNode(chick);

                bForceInactiveChicken = false;
                bFollowingChicken = true;

                scene.ToFire.RemoveAt(scene.ToFire.Count - 1);
            }
            else if (ev is MenuEvent && IsTopScreen)
            {
                if ((ev as MenuEvent).sender is MenuObj)
                {
                    if (((ev as MenuEvent).sender as MenuObj).Name == "pause")
                    {
                        PauseScreen s = new PauseScreen();
                        s.Initialize(Content);
                        ScreenManager.Get.AddScreen(s);
                    }
                    else if (((ev as MenuEvent).sender as MenuObj).Name == "restart")
                    {
                        Restart();
                        AudioManager.PlayOnce("Sounds/Restart");
                    }
                    else if (((ev as MenuEvent).sender as MenuObj).Name == "forceendgame")
                    {
                        //if (!AnyFox)
                        {
                            for (int i = 0; i < scene.Nodes.Count; i++)
                            {
                                if (scene.Nodes[i] is DonutCase)
                                {
                                    scene.Nodes[i].RaiseFlag(Flags.DELETE);
                                    scene.Nodes[i].UnloadContent();
                                    scene.Nodes.RemoveAt(i); --i;
                                }
                                else if(scene.Nodes[i] is Donut)
                                {
                                    scene.Nodes[i].RaiseFlag(Flags.DELETE);
                                    scene.Nodes[i].UnloadContent();
                                    scene.Nodes.RemoveAt(i); --i;
                                }
                            }
                            //HasWon = true;
                            LevelEndScreen n = new LevelEndScreen(this);
                            n.Initialize(Content);
                            ScreenManager.Get.AddScreen(n);

                            LowerFlag(Jabber.Flags.FADE_OUT);
                            LowerFlag(Jabber.Flags.FADE_IN);

                            if (GetRemainingFox() == 0)
                                AudioManager.PlayOnce("Sounds/Win_Stinger");
                            else
                                AudioManager.PlayOnce("Sounds/Lose_Stinger");
                        }
                    }
                }
            }
            base.ProcessEvent(ev);
        }
Ejemplo n.º 3
0
 public override void OnBackPress()
 {
     PauseScreen s = new PauseScreen();
     s.Initialize(Content);
     ScreenManager.Get.AddScreen(s);
 }
Ejemplo n.º 4
0
        public override void ProcessEvent(Jabber.Util.Event ev)
        {
            if (!IsTopScreen)
            {
                return;
            }
            if (ev is ExplosionEvent)
            {
                ExplosionPlayed = true;
            }
            if (!ExplosionPlayed)
            {
                /*
                 * if (ev is BreakableDestroyed && !(ev is BreakableHit))
                 * {
                 *  if (!SFXPlayed((ev as BreakableDestroyed).Broken))
                 *  {
                 *     // if (SFXTime((ev as BreakableDestroyed).Broken) <= 0)
                 *      {
                 *          BreakableBody.PlaySFXBreakForMaterial((ev as BreakableDestroyed).Broken);
                 *          SFXPlayed((ev as BreakableDestroyed).Broken, true);
                 *      }
                 *  }
                 *  else
                 *  {
                 *      int k = 0;
                 *  }
                 * }
                 * else if (ev is BreakableHit)
                 * {
                 *  if (!SFXPlayed((ev as BreakableHit).Broken))
                 *  {
                 *      if (SFXTime((ev as BreakableHit).Broken) <= 0.0f)
                 *      {
                 *          BreakableBody.PlayHitSFXForMaterial((ev as BreakableHit).Broken);
                 *          SFXPlayed((ev as BreakableHit).Broken, true);
                 *      }
                 *  }
                 * }*/
            }
            if (ev is CannonFireEvent && scene.ToFire.Count > 0)
            {
                CannonFireEvent e = ev as CannonFireEvent;

                Vector2 dir   = e.Dir;
                Chicken chick = null;// new Chicken_Dash(world);

                switch (scene.ToFire[scene.ToFire.Count - 1])
                {
                case 0:
                    chick = new Chicken(scene);
                    break;

                case 1:
                    chick = new Chicken_Dash(scene);
                    break;

                case 2:
                    chick = new Chicken_Egg(scene);
                    break;

                case 3:
                    chick = new Chicken_Explode(scene);
                    break;

                case 4:
                    chick = new Chicken_Mini_Launcher(scene);
                    break;
                }


                chick.Initialize(Content);
                chick.Position            = e.Position;
                chick.Body.LinearVelocity = dir;
                withChicks.AddNode(chick);

                bForceInactiveChicken = false;
                bFollowingChicken     = true;

                scene.ToFire.RemoveAt(scene.ToFire.Count - 1);
            }
            else if (ev is MenuEvent && IsTopScreen)
            {
                if ((ev as MenuEvent).sender is MenuObj)
                {
                    if (((ev as MenuEvent).sender as MenuObj).Name == "pause")
                    {
                        PauseScreen s = new PauseScreen();
                        s.Initialize(Content);
                        ScreenManager.Get.AddScreen(s);
                    }
                    else if (((ev as MenuEvent).sender as MenuObj).Name == "restart")
                    {
                        Restart();
                        AudioManager.PlayOnce("Sounds/Restart");
                    }
                    else if (((ev as MenuEvent).sender as MenuObj).Name == "forceendgame")
                    {
                        //if (!AnyFox)
                        {
                            for (int i = 0; i < scene.Nodes.Count; i++)
                            {
                                if (scene.Nodes[i] is DonutCase)
                                {
                                    scene.Nodes[i].RaiseFlag(Flags.DELETE);
                                    scene.Nodes[i].UnloadContent();
                                    scene.Nodes.RemoveAt(i); --i;
                                }
                                else if (scene.Nodes[i] is Donut)
                                {
                                    scene.Nodes[i].RaiseFlag(Flags.DELETE);
                                    scene.Nodes[i].UnloadContent();
                                    scene.Nodes.RemoveAt(i); --i;
                                }
                            }
                            //HasWon = true;
                            LevelEndScreen n = new LevelEndScreen(this);
                            n.Initialize(Content);
                            ScreenManager.Get.AddScreen(n);

                            LowerFlag(Jabber.Flags.FADE_OUT);
                            LowerFlag(Jabber.Flags.FADE_IN);

                            if (GetRemainingFox() == 0)
                            {
                                AudioManager.PlayOnce("Sounds/Win_Stinger");
                            }
                            else
                            {
                                AudioManager.PlayOnce("Sounds/Lose_Stinger");
                            }
                        }
                    }
                }
            }
            base.ProcessEvent(ev);
        }