예제 #1
0
 public Location GetLocationFromEnum(worldLocations loc)
 {
     for (int i = 0; i < locations.Count; i++)
     {
         // get the world location for this enum. Probably should use a dictionary, but those aren't serializable by unity out of the box
         if (locations[i].worldLocationEnumValue == loc)
         {
             return(locations[i]);
         }
     }
     Debug.LogError("Unable to find location from enum: " + loc);
     return(null); // this should never happen as long as all of the locs are setup, but bugs happen!
 }
예제 #2
0
    Character GetRandomCharacter(worldLocations loc)
    {
        // get a random character that spawns at that location
        // if no character spawns then make the game better, you managed to break it
        List <Character> possible = new List <Character>();

        for (int i = 0; i < characters.Count; i++)
        {
            worldLocations[] locs = characters[i].spawnLocations;
            for (int j = 0; j < locs.Length; j++)
            {
                if (locs[j] == loc || locs[j] == worldLocations.ALL)
                {
                    // then they're a possible character
                    possible.Add(characters[i]);
                    break; // stop checking this character we know they're possible.
                }
            }
        }
        return(possible[Random.Range(0, possible.Count)]); // return a random character
    }
예제 #3
0
    public void LookAtLocation(worldLocations loc)
    {
        Location l = GetLocationFromEnum(loc);

        pointCamera.SetTarget(l.cameraTarget);
    }