private Enemy GetEnemy(Job.JobArea area, int securityLevel, Job job, bool isBoss)
    {
        List <int> enemyIds = new List <int>();

        switch (area)
        {
        case Job.JobArea.Slums:
            int[] slumEnemyIds = { 0, 1, 2 };
            enemyIds.AddRange(slumEnemyIds);
            break;

        case Job.JobArea.Downtown:
            int[] downtownEnemyIds = { 3, 4, 5 };
            enemyIds.AddRange(downtownEnemyIds);
            break;
        }

        List <Job.EnemyType> jobEnemyTypes      = job.GetEnemyTypes();
        List <Enemy>         enemyPossibilities = new List <Enemy>();

        foreach (int id in enemyIds)
        {
            Enemy newEnemy = Resources.Load <Enemy>("Enemies/Enemy" + id.ToString());

            foreach (Job.EnemyType type in jobEnemyTypes)
            {
                if (newEnemy.GetEnemyTypes().Contains(type) && newEnemy.GetIsBoss() == isBoss && newEnemy.GetStarRating() <= job.GetJobDifficulty())
                {
                    enemyPossibilities.Add(newEnemy);
                    break;
                }
            }
        }
        return(enemyPossibilities[Random.Range(0, enemyPossibilities.Count)]);
    }
示例#2
0
    public int AttemptToSpawnSquares(Job.JobArea mapType, int percentChange, int remainingSquaresToSpawn, int verticalModifer, int chanceToSpawnEnemy)
    {
        int newSquareCount = 0;

        foreach (MapSquare square in activeSquares)
        {
            List <MapSquare> adjacentSquares = square.GetAdjacentSquares();
            foreach (MapSquare adjacentSquare in adjacentSquares)
            {
                if (newSquareCount < remainingSquaresToSpawn)
                {
                    int modifier = 0;
                    if (square.GetUpSquare() == adjacentSquare)
                    {
                        modifier += verticalModifer;
                    }

                    if (!adjacentSquare.IsActive() && Random.Range(0, 100) < percentChange + modifier)
                    {
                        adjacentSquare.InitializeSquare(mapSquareImageHolder.GetSquareImage(mapType), mapSquareImageHolder.GetLocationImage(mapType), false);
                        newSquareCount++;
                        if (Random.Range(0, 100) < chanceToSpawnEnemy)
                        {
                            MapData mapData = FindObjectOfType <MapData>();
                            adjacentSquare.SpawnEnemy(mapType, mapData.GetSecurityLevel(), mapData.GetJob());
                        }
                    }
                }
            }
        }
        mapGrid.ConsolidateNewActiveSquaresInAllRows();
        return(newSquareCount);
    }
示例#3
0
 public void SetMapData(CharacterData characterToSet, HackerData hackerToSet, Job.JobArea newMapType, int newSecurityLevel, int newMapSize, Job newJob)
 {
     runner        = characterToSet;
     hacker        = hackerToSet;
     mapType       = newMapType;
     securityLevel = newSecurityLevel;
     mapSize       = newMapSize;
     job           = newJob;
 }
    public void SetupGrid(Job.JobArea newMapType, int mapSize)
    {
        mapType              = newMapType;
        isInitialized        = true;
        activeRows           = new List <MapSquareRow>();
        mapSquareImageHolder = FindObjectOfType <MapSquareImageHolder>();
        mapSquareImageHolder.InitializeMapSquareImageHolder(mapType);

        SetupSquareLevels();
        SetupMap(mapType, mapSize, GetVerticalModifier(mapType), GetInitialEnemySpawnChance(mapType));
    }
示例#5
0
 public void SetupHackTarget(string newHackType)
 {
     redPoints   = 0;
     bluePoints  = 0;
     greenPoints = 0;
     isActive    = true;
     hackIsDone  = false;
     hackType    = newHackType;
     mapType     = FindObjectOfType <MapData>().GetMapType();
     //SetupHackTest();
 }
    private int GetInitialEnemySpawnChance(Job.JobArea mapType)
    {
        switch (mapType)
        {
        case Job.JobArea.Slums:
            return(50);

        case Job.JobArea.Downtown:
            return(50);
        }
        return(0);
    }
示例#7
0
    public void InitializeMapSquareImageHolder(Job.JobArea mapType)
    {
        switch (mapType)
        {
        case Job.JobArea.Slums:
            InitializeLists(maxSlumLocations, maxSlumSquares);
            break;

        case Job.JobArea.Downtown:
            InitializeLists(maxDowntownLocations, maxCitySquares);
            break;
        }
    }
    private int GetVerticalModifier(Job.JobArea mapType)
    {
        switch (mapType)
        {
        case Job.JobArea.Slums:
            return(35);

        case Job.JobArea.Downtown:
            return(75);

        default:
            return(35);
        }
    }
示例#9
0
    public void SetupMapObject(string newMapObjectType)
    {
        isActive      = true;
        mapObjectType = newMapObjectType;
        mapType       = FindObjectOfType <MapData>().GetMapType();

        // TODO: REMOVE THIS WHEN DONE WORKING ON TRAPS
        //mapObjectType = "Trap";

        if (mapObjectType == "Trap")
        {
            SetupTrap();
        }
    }
    private void SetupMap(Job.JobArea mapType, int mapSize, int mapSquareChanceForVerticalModifier, int percentEnemySpawn)
    {
        // initialize starting square in first row
        int activeSquares = 1;

        activeRows.Add(rows[startingRow]);
        MapSquare firstSquare = rows[startingRow].InitializeFirstSquare(startingSquare, mapSquareImageHolder.GetSquareImage(mapType));

        // then start spawning the rest
        int currentRow = startingRow;

        ConsolidateNewActiveSquaresInAllRows();
        while (activeSquares < mapSize)
        {
            // go through active rows and spawn squares around each active square
            for (int i = activeRows.Count - 1; i >= 0; i--)
            {
                int amountOfNewSquares = activeRows[i].AttemptToSpawnSquares(mapType, percentChanceForSpawn, mapSize - activeSquares, mapSquareChanceForVerticalModifier, percentEnemySpawn);
                activeSquares += amountOfNewSquares;
            }

            ConsolidateNewActiveSquaresInAllRows();

            // then look for active rows and add them to the active rows list, setting them up for spawns as well
            foreach (MapSquareRow row in rows)
            {
                if (row.ContainsActiveSquares() && !activeRows.Contains(row))
                {
                    activeRows.Add(row);
                }
            }
        }
        int activeSquareAccurateCount = 0;

        foreach (MapSquareRow row in rows)
        {
            activeSquareAccurateCount += row.CountActiveSquares();
        }

        // This is just for debug purposes
        //CheckNumberOfTransportationHacks();

        SpawnGoal(firstSquare);
    }
    public void LoadMap(Job.JobArea mapType, int mapSize, Job job)
    {
        PlayerData playerData = FindObjectOfType <PlayerData>();

        currentRunner = playerData.GetCurrentRunner();

        currentRunner.ResetHealthAndEnergy();

        currentHacker = playerData.GetCurrentHacker();
        currentMap    = Instantiate(mapData);
        currentMap.SetMapData(currentRunner, currentHacker, mapType, 10, mapSize, job);
        ChangeMusicTrack(job.GetJobArea());

        //SceneManager.LoadScene(mapSceneName);
        transitioner.gameObject.SetActive(true);
        Transitioner.Instance.TransitionToScene(mapSceneName);

        StartCoroutine(WaitForMapLoad(mapSceneName));
    }
示例#12
0
    public Sprite GetLocationImage(Job.JobArea mapType)
    {
        string locationString = "LocationImages";

        switch (mapType)
        {
        case Job.JobArea.Slums:
            locationString += "/Slums/Location";
            locationString += GetRandomLocationId().ToString();
            return(Resources.Load <Sprite>(locationString));

        case Job.JobArea.Downtown:
            locationString += "/City/Location";
            locationString += GetRandomLocationId().ToString();
            return(Resources.Load <Sprite>(locationString));
        }

        return(Resources.Load <Sprite>("LocationImages/City/Location1"));
    }
示例#13
0
    public Sprite GetSquareImage(Job.JobArea mapType)
    {
        string locationString = "Squares";

        switch (mapType)
        {
        case Job.JobArea.Slums:
            locationString += "/Slums/Square";
            locationString += GetRandomSquareId().ToString();
            return(Resources.Load <Sprite>(locationString));

        case Job.JobArea.Downtown:
            locationString += "/City/Square";
            locationString += GetRandomSquareId().ToString();
            return(Resources.Load <Sprite>(locationString));
        }
        // We should only hit this return in the case of a mistake
        return(Resources.Load <Sprite>("Squares/City/Square1"));
    }
 public void ChangeTrack(Job.JobArea name)
 {
     switch (name)
     {
         case Job.JobArea.HomeBase:
             audioSource.clip = homeBase;
             audioSource.loop = true;
             currentTrack = "homeBase";
             audioSource.Play();
             break;
         case Job.JobArea.Slums:
             audioSource.clip = slumsIntro;
             audioSource.loop = false;
             currentTrack = "slumsPreLoop";
             audioSource.Play();
             break;
         case Job.JobArea.Downtown:
             audioSource.clip = downtownIntro;
             audioSource.loop = false;
             currentTrack = "downtownPreLoop";
             audioSource.Play();
             break;
     }
 }
示例#15
0
    private string GainReward()
    {
        Job.JobArea mapType  = FindObjectOfType <MapGrid>().GetMapType();
        int         minRange = 0;
        int         maxRange = 0;

        switch (mapType)
        {
        case Job.JobArea.Slums:
            minRange = 100;
            maxRange = 300;
            break;

        case Job.JobArea.Downtown:
            minRange = 300;
            maxRange = 600;
            break;
        }

        int rewardAmount = Mathf.FloorToInt(Random.Range(minRange, maxRange));

        FindObjectOfType <MapData>().ChangeMoney(rewardAmount);
        return("Gained " + rewardAmount.ToString() + " Credits");
    }
 public Enemy GetAnEnemyByArea(Job.JobArea area, int securityLevel, Job job, bool isBoss)
 {
     return(GetEnemy(area, securityLevel, job, isBoss));
 }
 public void SpawnEnemy(Job.JobArea mapType, int securityLevel, Job job, bool isBoss = false)
 {
     // TODO: THIS SHOULD ALSO TAKE INTO ACCOUNT DIFFICULTY AND SECURITY LEVEL
     enemy = FindObjectOfType <EnemyCollection>().GetAnEnemyByArea(mapType, securityLevel, job, isBoss);
     //EmptyEnemyForTesting();
 }
 private void ChangeMusicTrack(Job.JobArea trackName)
 {
     musicPlayer.ChangeTrack(trackName);
 }