Exemplo n.º 1
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);
                }
            }
        }
Exemplo n.º 2
0
        public Scene(TopLevel.Game1 g, SpriteBatch sb)
        {
            game        = g;
            spriteBatch = sb;

            componentListIndices = new Dictionary <Type, ushort>();
            numComponents        = 0;

            lastEntity = 0;
        }