コード例 #1
0
        public void Update(GameTime gameTime)
        {
            lock (ListDelayedOnlineCommand)
            {
                foreach (DelayedExecutableOnlineScript ActiveCommand in ListDelayedOnlineCommand)
                {
                    ActiveCommand.ExecuteOnMainThread();
                }

                ListDelayedOnlineCommand.Clear();
            }

            for (int A = ListVisualEffects.Count - 1; A >= 0; --A)
            {
                SimpleAnimation ActiveVisualEffect = ListVisualEffects[A];
                ActiveVisualEffect.Update(gameTime);

                if (ActiveVisualEffect.HasEnded)
                {
                    ListVisualEffects.RemoveAt(A);
                }
            }

            for (int A = 0; A < ListAttackCollisionBox.Count; A++)
            {
                AttackBox ActiveAttackBox = (AttackBox)ListAttackCollisionBox[A];
                if (!ActiveAttackBox.IsAlive)
                {
                    continue;
                }

                ActiveAttackBox.Update(gameTime);

                foreach (KeyValuePair <uint, RobotAnimation> ActiveRobot in DicRobot)
                {
                    UpdateAttackCollisionWithRobot(gameTime, ActiveAttackBox, ActiveRobot.Value);
                }

                UpdateAttackCollisionWithWorld(ActiveAttackBox);

                ActiveAttackBox.Move(gameTime);
            }

            for (int A = ListImages.Count - 1; A >= 0; --A)
            {
                SimpleAnimation ActiveAnimation = ListImages[A];
                ActiveAnimation.Update(gameTime);

                if (ActiveAnimation.HasEnded)
                {
                    ListImages.RemoveAt(A);
                }
            }

            for (int P = ListProp.Count - 1; P >= 0; --P)
            {
                if (ListProp[P].HasEnded)
                {
                    ListProp.RemoveAt(P);
                }
                else
                {
                    ListProp[P].Update(gameTime);
                }
            }

            #region Robot Update

            foreach (RobotAnimation ActiveRobot in DicRobot.Values)
            {
                if (!ActiveRobot.IsUpdated)
                {
                    continue;
                }

                if (ActiveRobot.RobotAI != null && !Owner.UsePreview)
                {
                    ActiveRobot.RobotAI.UpdateStep(gameTime);
                }

                ActiveRobot.Update(gameTime, DicRobot);
            }

            foreach (RobotAnimation RobotToAdd in ListRobotToAdd)
            {
                SpawnRobot(RobotToAdd);
            }

            ListRobotToAdd.Clear();

            for (int R = ListRobotToRemove.Count - 1; R >= 0; R--)
            {
                DicRobot.Remove(ListRobotToRemove[R]);
                ListRobotToRemove.RemoveAt(R);

                if (ListRobotToRemove.Count == 0)
                {
                    Owner.CheckIfAllEnemiesAreDead();
                }
            }

            #endregion
        }