Exemplo n.º 1
0
        public CombatEncounter GetCurrentCombatEncounter()
        {
            CombatEncounter combatEncounter = new CombatEncounter();

            combatEncounter.map           = new Map();
            combatEncounter.map.Buildings = new List <Building>();
            BoardController        boardController = Service.BoardController;
            Board                  board           = boardController.Board;
            LinkedList <BoardItem> children        = board.Children;

            if (children != null)
            {
                foreach (BoardItem current in children)
                {
                    BoardCell         currentCell       = current.CurrentCell;
                    Entity            data              = current.Data;
                    BuildingComponent buildingComponent = data.Get <BuildingComponent>();
                    if (buildingComponent != null)
                    {
                        Building building = new Building();
                        building.Key            = buildingComponent.BuildingTO.Key;
                        building.Uid            = buildingComponent.BuildingType.Uid;
                        building.X              = Units.BoardToGridX(currentCell.X);
                        building.Z              = Units.BoardToGridZ(currentCell.Z);
                        building.CurrentStorage = buildingComponent.BuildingTO.CurrentStorage;
                        combatEncounter.map.Buildings.Add(building);
                    }
                }
            }
            combatEncounter.map.Planet = Service.CurrentPlayer.Map.Planet;
            return(combatEncounter);
        }
Exemplo n.º 2
0
 public int CalculateWalkableGap(SizeComponent size)
 {
     if (Units.BoardToGridX(size.Width) > 1 && Units.BoardToGridZ(size.Depth) > 1)
     {
         return(1);
     }
     return(0);
 }
Exemplo n.º 3
0
 public void SyncWithTransform(TransformComponent transform)
 {
     this.X = Units.BoardToGridX(transform.X);
     this.Z = Units.BoardToGridZ(transform.Z);
 }