Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        person       = GameManager.instance.person;
        bolinasTiles = map.GetComponentsInChildren <BolinasTile>();

        foreach (BolinasTile tile in bolinasTiles)
        {
            if (tile.name == person.bolinasTile)
            {
                currentLocation = tile;
                break;
            }
        }

        // start the first turn section
        bool turned = false;

        mapCamera.PanTo(currentLocation.transform.position);

        for (int i = 0; i < currentLocation.neighbors.Length; i++)
        {
            if (turned == false && currentLocation.neighbors[i] != null)
            {
                mapCamera.gameObject.RotateTo(currentLocation.transform.position,
                                              currentLocation.neighbors[i].transform.position);
                turned = true;
            }

            if (currentLocation.neighbors[i] == null)
            {
                availableTurns[i].interactable = false;
            }
        }
    }
Example #2
0
    public void GoTo(int neighbor)
    {
        BolinasTile oldLocation    = currentLocation;
        int         chosenNeighbor = neighbor;

        chosenNeighbor -= oldLocation.offset;

        if (chosenNeighbor < 0)
        {
            chosenNeighbor += oldLocation.neighbors.Length;
        }

        if (oldLocation.neighbors[chosenNeighbor].DangerFromFire())
        {
            //print("new location on fire");
            //print(oldLocation.neighbors[chosenNeighbor].name);
            StartCoroutine("ShowFireWarning");
            print("fire");
        }
        else
        {
            // TODO the fire spreads more depending on
            // Traffic conditions of the tile
            // transportation of the person
            currentLocation = oldLocation.neighbors[chosenNeighbor];
            SpreadFire();
            ShowTurns(oldLocation, currentLocation);
        }
    }
Example #3
0
    public void ShowTurns(BolinasTile origin, BolinasTile currentLocation)
    {
        //print("coming from" + origin.name);
        //print("now in " + currentLocation.name);
        int originIndex = 0;

        for (int i = 0; i < currentLocation.neighbors.Length; i++)
        {
            if (currentLocation.neighbors[i] == origin)
            {
                originIndex = i;
                break;
            }
        }

        // originIndex is which tile player is coming from with respect
        // to current location list of neighbors
        if ((Turn)originIndex == Turn.straight)
        {
            UpdateButtons(2);
        }
        else if ((Turn)originIndex == Turn.right)
        {
            UpdateButtons(1);
        }
        else if ((Turn)originIndex == Turn.back)
        {
            UpdateButtons(0);
        }
        else if ((Turn)originIndex == Turn.left)
        {
            UpdateButtons(3);
        }
        mapCamera.gameObject.RotateTo(origin.transform.position,
                                      currentLocation.transform.position);
    }