Example #1
0
        void UpdateTrajectory()
        {
            if (currentFireDir == LastDir)
            {
                return;
            }

            LastDir = currentFireDir;
            trajectorypositions.Clear();

            if (currentFireDir.Length() > 0)
            {
                JabActor circle = projectileWorld.CreateSphere(75, Position, JabActor.BodyType.DYNAMIC);
                circle.LinearVelocity = (currentFireDir);

                Vector2 LastPos = Vector2.Zero;
                for (int i = 0; i < 200; i++)
                {
                    if (i > 0 && i % 4 == 0)
                    {
                        RayCastHit hit = screen.withChicks.World.RayCast(LastPos, circle.Position);
                        if (hit.actor != null)
                        {
                            trajectorypositions.Add(hit.worldImpact);
                            break;
                        }
                    }
                    if (circle.PosY < 0)
                    {
                        break;
                    }
                    if (i % 4 == 0)
                    {
                        trajectorypositions.Add(circle.Position);
                        LastPos = circle.Position;
                    }

                    projectileWorld.Update(new GameTime(new TimeSpan(0, 0, 0, 0, 33), new TimeSpan(0, 0, 0, 0, 33)));
                }
                circle.RaiseFlag(Jabber.Flags.DELETE);
            }
        }
Example #2
0
        public override void Update(GameTime dt)
        {
            if (!AudioManager.MusicPlaying)
            {
                Dictionary <string, string> loctosong = new Dictionary <string, string>();

                string currentSong = AudioManager.CurrentSong;
                if (currentSong == "troublemaker")
                {
                    AudioManager.PlayMusic(location);
                }
                else
                {
                    AudioManager.PlayMusic("troublemaker");
                }
            }
#if WINDOWS_PHONE
            AdSystem.TargetTop = false;
#endif

            ExplosionPlayed = false;
            woodSFX         = cementSFX = glassSFX = false;
            cementTime     -= gttf(dt);
            woodTime       -= gttf(dt);
            glassTime      -= gttf(dt);
            if (!IsTopScreen)
            {
                for (int i = 0; i < scene.Nodes.Count; i++)
                {
                    //if (scene.Nodes[i] is Fox)
                    {
                        scene.Nodes[i].Update(dt);
                    }
                }
                return;
            }
            feathers.Update(dt);
            if (!loadedUp)
            {
                return;
            }
            if (CheckFlag(Jabber.Flags.FADE_IN))
            {
                if (loadedUp)
                {
                    OnFadeInComplete();
                }
            }
            else
            {
                world.Update(dt);
                base.Update(dt);
                timer   += gttf(dt);
                gameTime = dt;

                CheckEndGame(dt);
            }

            if (blank != null)
            {
                blank.Update(dt);
                if (blank.StateFlag == Jabber.StateFlag.FADE_IN_COMPLETE)
                {
                    if (!IsQuitting)
                    {
                        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");
                        }
                    }
                    else
                    {
                        RaiseFlag(Jabber.Flags.DELETE);
                        WorldSelectScreen s = new WorldSelectScreen();
                        s.Initialize(Content);
                        s.SetCurrentCountry(location);
                        ScreenManager.Get.AddScreen(s);
                    }
                }
            }
        }