public void AddTerrain(TerrainComponent myTerrain) { terrainList.Add(myTerrain); }
//TODO: Add row baseHexLayer support public void AddTerrain(Vector2 myCoordinate, int myTerrainLayer, TerrainPackage myTerrain) { HexComponent hexComponent = GetHex(myCoordinate); Entity hexEntity = hexComponent._parent; SpriteComponent hexSprite = hexComponent._parent.GetDrawable("SpriteComponent") as SpriteComponent; int baseHexLayer = 0; for (int y = 0; y < hexEntityGrid.GetLength(1); y++) { for (int x = 0; x < hexEntityGrid.GetLength(0); x++) { if (hexEntityGrid[x, y] == hexEntity) { baseHexLayer = hexEntityGrid[x, y].GetLayer(); } } } Entity terrainEntity = new Entity(2 + baseHexLayer + myTerrainLayer, State.ScreenState.SKIRMISH); terrainEntity.AddComponent(new SpriteComponent(true, hexSprite.GetCenterPosition(), myTerrain.GetTexture())); TerrainComponent terrComp = new TerrainComponent(hexComponent, myTerrain.GetTexture(), myTerrain.GetImpassable(), myTerrain.GetVisionBlocked()); terrainEntity.AddComponent(terrComp); hexComponent.AddTerrain(terrComp); EntityManager.AddEntity(terrainEntity); }
public void RemoveTerrain(TerrainComponent myTerrain) { terrainList.Remove(myTerrain); }