コード例 #1
0
        // Spawns a cached object, moves into active obj list and update loop. Physics bodies reset.
        protected void Activate(string key)
        {
            GameObject gameObject;

            if (!CachedGameObjects.ContainsKey(key))
            {
                Console.Error.WriteLine("Room : \"{0}\" : Activate() : Keyname \"{1}\" not found in loaded objects", Key, key);
                return;
            }
            gameObject = CachedGameObjects[key];
            if (!gameObject.Active)
            {
                ActiveGameObjects.Add(gameObject);
                gameObject.PreActivate();
                if (gameObject.Drawable)
                {
                    DrawableGameObjects.Add(gameObject);
                }
                if (gameObject.Body != null)
                {
                    gameObject.Body.BoxCollider.Data = gameObject.Body.Category;
                    foreach (Hitbox childHitbox in gameObject.Body.ChildHitboxes.Values)
                    {
                        World.AddHitbox(childHitbox);
                    }
                }
            }
        }