Beispiel #1
0
        private void OnTimeUpdatedEvent(World.TimeUpdatedEvent eventArgs)
        {
            if (launchTime == null)
            {
                return;
            }

            TimeSpan time = eventArgs.time.TotalGameTime - launchTime;

            if (CurrentState == State.ALIVE)
            {
                //       position.X = ((float)time.Seconds % 10f) * (1f / 10f) + 0.1f * time.Milliseconds / 1000f;
            }
            else
            {
                explosionTime += eventArgs.time.ElapsedGameTime.Milliseconds / 1000f;
            }

            /*
             * for (int i = 0; i < 100; i++)
             * {
             *  line.ClearVectors();
             *  float c = 1f - time.TotalGameTime.Milliseconds / 1000f;
             *  line.Colour = new Color(c, c, c, c);
             *  line.CreateCircle(time.TotalGameTime.Milliseconds / 3f, 40);
             * }
             */
        }
Beispiel #2
0
        private void OnTimeUpdatedEvent(World.TimeUpdatedEvent eventArgs)
        {
            if (CurrentState != State.ALIVE || IsOffScreen())
            {
                return;
            }


            GameTime time = eventArgs.time;

            if (GameScreenManager.Instance.GetActiveScreenID() != BattleScreen.ID || GameState.Instance.CurrentGameState != GameState.State.DURING_GAMEPLAY)
            {
                lastUpdate = time.TotalGameTime;
                return;
            }

            if (lastUpdate == null)
            {
                lastUpdate = time.TotalGameTime;
            }
            else
            {
                TimeSpan span = time.TotalGameTime - lastUpdate;
                UpdateScreenPosition(span);
                lastUpdate = time.TotalGameTime;

                if (IsOffScreen())
                {
                    SoundPlayer.Instance.StopSound("mothershipSound");
                }
            }
        }
Beispiel #3
0
        public void OnNotification(IEventPublisher publisher, EventArgs eventArgs)
        {
            World.TimeUpdatedEvent timeEvent = eventArgs as World.TimeUpdatedEvent;

            if (timeEvent != null)
            {
                OnTimeUpdatedEvent(timeEvent);
                return;
            }
        }
Beispiel #4
0
        private void OnTimeUpdatedEvent(World.TimeUpdatedEvent eventArgs)
        {
            GameTime time = eventArgs.time;

            if (lastUpdate == null)
            {
                lastUpdate = time.TotalGameTime;
            }
            else
            {
                TimeSpan span = time.TotalGameTime - lastUpdate;
                UpdateScreenPosition(span);
                lastUpdate = time.TotalGameTime;
            }
        }
Beispiel #5
0
        private void OnTimeUpdatedEvent(World.TimeUpdatedEvent eventArgs)
        {
            GameTime time = eventArgs.time;

            if (playerMissle.IsOffScreen() && transitionState == TransitionState.ON_SCREEN && GameState.Instance.CurrentGameState == GameState.State.DURING_GAMEPLAY)
            {
                FireMissle();
            }

            List <Missle> toRemove = new List <Missle>();

            foreach (Missle m in enemyMissles)
            {
                if (m.IsOffScreen() && transitionState == TransitionState.ON_SCREEN)
                {
                    unusedMissles.Add(m);
                    toRemove.Add(m);
                }
            }
            foreach (Missle m in toRemove)
            {
                enemyMissles.Remove(m);
            }

            if (transitionState == TransitionState.ON_SCREEN && GameState.Instance.CurrentGameState == GameState.State.DURING_GAMEPLAY)
            {
                if (player.CurrentState.Equals(Player.State.ALIVE))
                {
                    GameState.Instance.BattleTime += time.ElapsedGameTime.Milliseconds / 1000f;
                    CalculateEnemyPath(time.ElapsedGameTime.Milliseconds / 1000f);

                    if (random.NextDouble() < time.ElapsedGameTime.Milliseconds / 1000f && random.NextDouble() < (double)GameState.Instance.Level / 5f)
                    {
                        FireEnemyMissle();
                    }

                    if (motherShip.CurrentState == MotherShip.State.DEAD && GameState.Instance.HordlePos.Y > 0.12f + motherShipPos)
                    {
                        motherShip.SetPos(new Vector2(-0.4f, 0.15f));
                        motherShip.CurrentState = MotherShip.State.ALIVE;
                        SoundPlayer.Instance.PlaySound("mothershipSound");
                    }
                }
            }
        }
Beispiel #6
0
        public void OnNotification(IEventPublisher publisher, EventArgs eventArgs)
        {
            World.TimeUpdatedEvent           timeEvent      = eventArgs as World.TimeUpdatedEvent;
            PropertyAnimation.AnimationEnded animEndedEvent = eventArgs as PropertyAnimation.AnimationEnded;

            if (timeEvent != null)
            {
                OnTimeUpdatedEvent(timeEvent);
                return;
            }
            else if (animEndedEvent != null)
            {
                OnAnimEnded(animEndedEvent);
            }
            else if (eventArgs as Player.PlayerDied != null)
            {
                OnPlayerDied();
            }

            return;
        }
Beispiel #7
0
 private void OnTimeUpdatedEvent(World.TimeUpdatedEvent eventArgs)
 {
     explosionTime += eventArgs.time.ElapsedGameTime.Milliseconds / 1000f;
 }