Exemple #1
0
        public static void Update()
        {
            for (byte worldId = 0; worldId < sInstance.Length; ++worldId)
            {
                World world = sInstance[worldId];

                world.mTickCounter.Update();

                //update all game objects- sometimes they want to die, so we need to tread carefully...

                for (int i = 0, c = world.mGameObjects.Count; i < c; ++i)
                {
                    NetGameObject go = world.mGameObjects[i];
                    if (!go.DoesWantToDie())
                    {
                        go.Update();
                    }
                    //you might suddenly want to die after your update, so check again
                    if (go.DoesWantToDie())
                    {
                        world.RemoveGameObject(go);
                        go.HandleDying();
                        --i;
                        --c;
                    }
                }
            }
        }