private static void CreateEntitiesInArray()
        {
            for (int i = 0; i < numberOfEntities; i++)
            {
                PhysicsComponent p = new PhysicsComponent();
                AIComponent ai = new AIComponent();
                RenderComponent r = new RenderComponent();

                _physicsComponents[i] = p;
                _aiComponents[i] = ai;
                _renderComponents[i] = r;

                GameEntity g = new GameEntity(p, ai, r);
                _entities[i] = g;
            }
        }
示例#2
0
        private static void CreateEntitiesInArray()
        {
            for (int i = 0; i < numberOfEntities; i++)
            {
                PhysicsComponent p  = new PhysicsComponent();
                AIComponent      ai = new AIComponent();
                RenderComponent  r  = new RenderComponent();

                _physicsComponents[i] = p;
                _aiComponents[i]      = ai;
                _renderComponents[i]  = r;

                GameEntity g = new GameEntity(p, ai, r);
                _entities[i] = g;
            }
        }
 // for this to work, the components should be passed as pointers
 // this is NOT possible in C#
 // can use pass by reference or unsafe context ... but still not the same as in C++
 public GameEntity(PhysicsComponent physics, AIComponent ai, RenderComponent render)
 {
     Physics = physics;
     Ai = ai;
     Render = render;
 }
示例#4
0
 // for this to work, the components should be passed as pointers
 // this is NOT possible in C#
 // can use pass by reference or unsafe context ... but still not the same as in C++
 public GameEntity(PhysicsComponent physics, AIComponent ai, RenderComponent render)
 {
     Physics = physics;
     Ai      = ai;
     Render  = render;
 }