Esempio n. 1
0
 public void moveCriminals(TileMaker TM)
 {
     //TileMaker TM = this.GetComponent<TileMaker>();
     foreach (Criminal c in criminals)
     {
         if (c.canMove)
         {
             Tile t      = TM.findTileAtLocation(c.x, c.z);
             int  offset = Random.Range(0, 4);
             for (int i = 0; i < 4; i++)
             {
                 int mod = (offset + i) % 4;
                 if (t.openings[mod] && t.neighbours[mod] != null)
                 {
                     Tile n = t.neighbours[mod];
                     if (n.type != "blank" && !n.hasCriminal && !n.hasRoadBlock)
                     {
                         c.setLocation(n.x, n.z);
                         n.setCriminal(c);
                         t.setCriminal(null);
                         break;
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
    public void buildOutpost(Tile t, TileMaker tm)
    {
        if (t.hasBuilding)
        {
            guiManager.displayTooltip("This block already has a building.");
        }
        else
        {
            t.hasBuilding = true;
            t.hasOutpost  = true;
            for (int i = -1; i <= 1; i++)
            {
                for (int j = -1; j <= 1; j++)
                {
                    Tile s = tm.findTileAtLocation(t.x + i, t.z + j);
                    if (s != null)
                    {
                        s.isWatched = true;
                    }
                }
            }
            addExpense(prices.outpost);

            GameObject outpostObject = Instantiate(outpostPrefab);
            outpostObject.transform.parent   = upgrades_folder.transform;
            outpostObject.transform.position = new Vector3(t.x, 0, t.z);
        }
    }
Esempio n. 3
0
    public void moveCommand(int direction)
    {
        if (copScript.hasAP())
        {
            guiManager.displayAPWarning(false);
            if (currentTileScript.openings[direction])
            {
                // move the cop and camera
                copScript.move(direction);
                mainCamera.transform.position = copObject.transform.position + new Vector3(0, 4.5f, 0);
                // update GUI as required
                if (endConfirmed)
                {
                    endConfirmed = false;
                }                                                           // turns off "are you sure?"
                // highlight endturnbtn if appropriate
                if (copScript.AP == 0)
                {
                    guiManager.updateEndTurn(true, false);
                }
                else
                {
                    guiManager.updateEndTurn(false, false);
                }
                guiManager.updateCopInfo(copScript.AP);                 // update action points display

                // update current tile script and object
                currentTileScript = tileMaker.findTileAtLocation(copScript.x, copScript.z);
                currentTileObject = currentTileScript.gameObject;
                // flip the tile if it was blank
                if (currentTileScript.type == "blank")
                {
                    currentTileScript = tileMaker.flipTile(currentTileScript);
                    currentTileObject = currentTileScript.gameObject;
                    guiManager.displayStats(statsManager);
                }
            }
        }
        else
        {
            guiManager.displayAPWarning(true);
        }
    }