public EnemyPartyManager GetRandomEncounter(AreaNames currArea)
    {
        Debug.Log(currArea);
        List <EnemyPartyManager> currAreaList = null;

        switch (currArea)
        {
        case (AreaNames.MOUNTAIN):
            currAreaList = mountainParties;
            break;

        default:
            currAreaList = grasslandParties;
            break;
        }

        int randPartyIndex   = UnityEngine.Random.Range(0, currAreaList.Count);
        int occurrenceChance = UnityEngine.Random.Range(1, 5);


        if (occurrenceChance <= currAreaList[randPartyIndex].occurrenceRate)
        {
            return(currAreaList[randPartyIndex]);
        }
        else
        {
            if (tries-- < 0)
            {
                throw new System.Exception("Invalid party Occurrence rate!");
            }
            return(GetRandomEncounter(currArea));
        }
    }
    private void Start()
    {
        fadeTransition = GetComponent <FadeTransition>();
        fsTransition   = GetComponent <FourSideTransition>();
        gm             = this;
        currAreaName   = AreaNames.GRASSLAND;

        allEffects = GetComponent <AllEffects>();
    }
    // returns true if a battle started
    public static bool AdvanceStepCount(char groundType)
    {
        AreaNames currArea = AreaNames.GRASSLAND;

        switch (groundType)
        {
        case ('g'):
            encounterStep -= 1;
            break;

        case ('s'):
            encounterStep -= 1;
            currArea       = AreaNames.DESERT;
            break;

        case ('r'):
            encounterStep -= 2;
            currArea       = AreaNames.GRASSLAND;
            break;

        case ('\0'):
            encounterStep -= 1;
            currArea       = AreaNames.OCEAN;
            break;

        default:
            encounterStep--;
            break;
        }
        GameManager.currAreaName = currArea;
        if (encounterStep < 0)
        {
            encounterStep = UnityEngine.Random.Range(8, 24);
            BattleManager.bManager.StartBattle();
            return(true);
        }
        return(false);
    }
Пример #4
0
 public void AssignLocation(AreaNames newLocation)
 {
     currentArea  = newLocation;
     startingArea = newLocation; //Remove later.
     Console.WriteLine(currentArea);
 }
 public AreaBehaviour(AreaNames name, Faction factionInControl)
 {
     areaName           = name;
     controllingFaction = factionInControl;
     LoadArea();
 }