Beispiel #1
0
        public GameWorld(uint maxEntities, Game game, int cellSize)
        {
            CellSize = cellSize;

            HealthComponents = new HealthComponent[MAX_ENTITIES];
            SpatialComponents = new SpatialComponent[MAX_ENTITIES];
            RegenerationComponents = new RegenerationComponent[MAX_ENTITIES];
            SpriteComponents = new SpriteComponent[MAX_ENTITIES];
            PhysicsComponents = new PhysicsComponent[MAX_ENTITIES];
			CollisionComponents = new TilemapCollisionComponent[MAX_ENTITIES];
			FlammableComponents = new FlammableComponent[MAX_ENTITIES];
            InputComponents = new InputComponent[MAX_ENTITIES];
            EnemyAIComponents = new EnemyAIComponent[MAX_ENTITIES];
            MeleeCombatComponents = new MeleeCombatComponent[MAX_ENTITIES];

            for (int i = 0; i < MAX_ENTITIES; i++)
            {
                HealthComponents[i] = new HealthComponent();
                SpatialComponents[i] = new SpatialComponent();
                RegenerationComponents[i] = new RegenerationComponent();
                SpatialComponents[i] = new SpatialComponent();
                PhysicsComponents[i] = new PhysicsComponent();
                CollisionComponents[i] = new TilemapCollisionComponent();
                FlammableComponents[i] = new FlammableComponent();
                InputComponents[i] = new InputComponent();
                EnemyAIComponents[i] = new EnemyAIComponent();
                MeleeCombatComponents[i] = new MeleeCombatComponent();
            }


            HealthSubsystem = new HealthSubsystem(this);
            PhysicsSubsystem = new PhysicsSubsystem(this);
            SpriteRendererSubsystem = new SpriteRendererSubsystem(game.Window, this);
			CollisionSubsystem = new CollisionSubsystem (this);
			StatusEffectsSubsystem = new StatusEffectsSubsystem (this);
            InputSubsystem = new InputSubsystem(this);
            EnvironmentalSubsystem = new EnvironmentalSubsystem(this);
            AISubsystem = new AISubsystem(this);
            MeleeCombatSubsystem = new MeleeCombatSubsystem(this);
        }
Beispiel #2
0
 private void FoundEntity(EnemyAIComponent ai)
 {
     ai.States.Push(AIStates.InCombat);
 }