Example #1
0
        public static G Build <G>(GraphicModule graphicModule, BaseEntity entity, bool addToMainLoop = true)
            where G : GameObject
        {
            Type t = typeof(G);

            var obj = (G)Activator.CreateInstance(t, new Object[] { graphicModule, entity, new Controller() });

            if (addToMainLoop)
            {
                MainLoop.AddGameObject(obj);
            }
            else
            {
                obj.Entity.OnDeath();
                MainLoop.AddGameObjectToBackend(obj);
            }

            return(obj);
        }