Esempio n. 1
0
 public void MoveToNextTileInPath()
 {
     MoveUnit(path.First());
     movementLeft--;
     grid.DiscoverArea(path.First(), 2);
     path.RemoveAt(0);
 }
Esempio n. 2
0
 public void Settle()
 {
     if (selectedUnit != null && selectedUnit.type == Unit.UnitTypes.Settler)
     {
         TileCell   cell = selectedUnit.cell;
         GameObject go   = Instantiate(cityCenterPrefab);
         go.transform.position = new Vector3(cell.x, 0, cell.y);
         grid.DiscoverArea(cell, 3, false);
         DeleteUnit(selectedUnit);
         city.ActivateCity();
         GameObject.Find("Canvas").transform.Find("Settler").gameObject.SetActive(false);
         city.cell = cell;
         city.PlaceZone(cell, Zones.Civic);
     }
 }
Esempio n. 3
0
    // Start is called before the first frame update
    void Start()
    {
        city       = GameObject.Find("City").GetComponent <City>();
        pathfinder = GameObject.Find("Pathfinder").GetComponent <Pathfinding>();
        grid       = GameObject.Find("Grid").GetComponent <TileGrid>();
        GameObject goUnit = Instantiate(unitPrefab);

        goUnit.transform.position = new Vector3(0, 0, 0);
        TileCell unitsCell = grid.cells.First(p => p.x == 0 && p.y == 0);

        unitsCell.SetUnit(goUnit);
        goUnit.GetComponent <Unit>().SetTileCell(unitsCell);
        units.Add(goUnit.GetComponent <Unit>());
        grid.DiscoverArea(unitsCell, 2);
        grid.RenderTileUI();
    }