コード例 #1
0
ファイル: Scene.cs プロジェクト: Karob2/eventide
        public Scene(bool privateLibraries)
        {
            this.privateLibraries = privateLibraries;

            entityList = new List <Systems.Entity>();

            physics = new Systems.Physics();

            if (privateLibraries)
            {
                textureLibrary = new Libraries.TextureLibrary();
                Libraries.TextureLibrary.AddLibrary(textureLibrary);
                spriteLibrary = new Libraries.SpriteLibrary(textureLibrary);
                Libraries.SpriteLibrary.AddLibrary(spriteLibrary);
            }
            else
            {
                textureLibrary = GlobalServices.GlobalTextures;
                spriteLibrary  = GlobalServices.GlobalSprites;
            }

            methodQueue = new List <MethodQueueItem>();

            //GlobalServices.TextHandler.Stop();
        }
コード例 #2
0
        public TestScene(TopLevel.Game1 g, SpriteBatch sb) : base(g, sb)
        {
            transforms = RegisterComponentList <Components.Transform>();
            bodies     = RegisterComponentList <Components.Body>();
            behaviors  = RegisterComponentList <Components.Behavior>();
            avatars    = RegisterComponentList <Components.Avatar>();

            behavior = new Systems.Behavior(
                behaviors,
                bodies, componentListIndices[typeof(Components.Body)],
                avatars, componentListIndices[typeof(Components.Avatar)]);
            physics = new Systems.Physics(
                transforms, componentListIndices[typeof(Components.Transform)],
                bodies, componentListIndices[typeof(Components.Body)]);
            renderer = new Systems.Renderer(
                avatars,
                transforms, componentListIndices[typeof(Components.Transform)]);

            Prefabs.Vivo.Create(this, transforms, bodies, behaviors, avatars);
            Random random = new Random();

            for (ushort i = 0; i < 500; i++)
            {
                if (random.NextDouble() > 0.5)
                {
                    Prefabs.Kirk.Create(this, transforms, bodies, behaviors, avatars, random, W, H);
                }
                else
                {
                    Prefabs.Bolinha.Create(this, transforms, bodies, behaviors, avatars, random, W, H);
                }
            }
        }