예제 #1
0
    private void Start()
    {
        ggm                  = GlobalGameManager.instance;
        levelLength          = ggm.GetLevelLength();
        enemyFrequency       = ggm.GetEnemyFrequency();
        enemyPrefabs         = ggm.GetEnemyPrefabs();
        enemySpawnOrder      = ggm.GetEnemySpawnOrder();
        renderDistance       = ggm.GetRenderDistance();
        seed                 = ggm.GetSeed();
        enemySpawnPositions  = ggm.GetSpecialObjectLocations();
        enemySpecificPrefabs = ggm.GetEnemySpecificPrefabs();

        enemyPointer    = 0;
        playerTransform = GameObject.Find("Player").transform;
        pseudoRandom    = new System.Random(seed.GetHashCode());
        // TODO: Adjust count for obstacle & obstacle difficulty
        int count = 3;

        if (enemyPrefabs.Count > 0)
        {
            PopulatePool(enemyPrefabs, enemyPrefabPool, count);
        }
        PopulateRandomLocations();
        PopulateSpawnOrder();
        if (enemySpecificPrefabs.Count > 0)
        {
            PopulateLocatedObjects(terrainParent, enemySpecificPrefabs, enemySpawnPositions);
        }
    }
예제 #2
0
 private void Start()
 {
     ggm             = GlobalGameManager.instance;
     levelLength     = ggm.GetLevelLength();
     playerPos       = GameObject.Find("Player").transform;
     objectTransform = gameObject.transform;
     startPosition   = gameObject.transform.position;
     if (levelLength <= 0)
     {
         levelLength = 10;
     }
 }
예제 #3
0
    private void AcquireLevelStatistics()
    {
        crystalPos        = ggm.GetCrystalLocations();
        initialDelay      = ggm.GetInitialDelay();
        levelLength       = ggm.GetLevelLength();
        renderDistance    = ggm.GetRenderDistance();
        terrainPrefabs    = ggm.GetTerrainPrefabs();
        terrainSpawnOrder = ggm.GetTerrainSpawnOrder();
        // Handling the appropriate seed.
        seed = ggm.GetSeed();
        if (seed == string.Empty)
        {
            seed = "StandardSeed";
        }
        if (ggm.GetRandomSeed())
        {
            seed = DateTime.Now.Ticks.ToString();
        }
        pseudoRandom = new System.Random(seed.GetHashCode());
        float totalTerrainLength = 0;

        if (terrainSpawnOrder.Count >= 1)
        {
            if (terrainPrefabs.Count > 0)
            {
                for (int i = 0; i < terrainSpawnOrder.Count; i++)
                {
                    // see what the length is between child 0 and 1 for the level and add it up.
                    totalTerrainLength += Mathf.Abs(terrainPrefabs[terrainSpawnOrder[i]].transform.GetChild(0).transform.position.x -
                                                    terrainPrefabs[terrainSpawnOrder[i]].transform.GetChild(1).transform.position.x);
                }
                // It's +45 because we begin populating from the LocatorRear which is at -30, and we want ~15m past the finishline
                PopulateTerrainSpawnOrder(totalTerrainLength);
            }
            else
            {
                Debug.Log("Terrain Prefab pool doesn't have anything in it");
            }
        }
        else
        {
            PopulateTerrainSpawnOrder(totalTerrainLength);
        }

        // placing the LevelBoundary Deactivator so it shuts off when it's supposed to.
        levelBoundaryRear.transform.GetChild(2).transform.position = new Vector3(-19 +
                                                                                 terrainPrefabs[terrainSpawnOrder[0]].transform.GetChild(1).transform.position.x, 0, 0);
    }
예제 #4
0
 // TODO: Check which crystals are already collected and populate accordingly.
 void Start()
 {
     ggm                = GlobalGameManager.instance;
     lc                 = GameObject.Find("LevelController").GetComponent <LevelController>();
     rluiController     = GameObject.Find("UI").GetComponent <RLUIController>();
     pfd                = GameObject.Find("GlobalGameManager/PlayFabController/PlayFabDataController").GetComponent <PlayFabData>();
     completionRewards  = GameObject.Find("GlobalGameManager/LevelData/Completion").GetComponent <RewardGroup>();
     firstTimeRewards   = GameObject.Find("GlobalGameManager/LevelData/FirstTime").GetComponent <RewardGroup>();
     masteryRewards     = GameObject.Find("GlobalGameManager/LevelData/Mastery").GetComponent <RewardGroup>();
     levelLength        = ggm.GetLevelLength();
     spellMultiplier    = ggm.GetSpellMultiplier();
     spellMultiplierCap = ggm.GetSpellMultiplierCap();
     speedMultiplierCap = ggm.GetMaxSpeedBonus();
     maxSpeed           = ggm.GetMaxVelocity();
     scoreMarks         = ggm.GetScoreMarks();
     scoreCap           = ggm.GetScoreCap();
     freeMovement       = ggm.GetFreeMovement();
     levelName          = ggm.GetLevelName();
     if (freeMovement)
     {
         levelTime = 0;
     }
     levelPerformance = ggm.GetLevelPerformance();
     if (levelPerformance == null)
     {
         levelPerformance = string.Empty;
     }
     if (levelPerformance.Contains("R"))
     {
         rluiController.OnCrystal("Red");
         lc.CollectRedCrystal();
         OnCrystalCollect("Red");
     }
     if (levelPerformance.Contains("G"))
     {
         rluiController.OnCrystal("Green");
         lc.CollectGreenCrystal();
         OnCrystalCollect("Green");
     }
     if (levelPerformance.Contains("B"))
     {
         rluiController.OnCrystal("Blue");
         lc.CollectBlueCrystal();
         OnCrystalCollect("Blue");
     }
     StartCoroutine(GetCompletionData());
 }
예제 #5
0
 // Start is called before the first frame update
 void Start()
 {
     ggm                = GlobalGameManager.instance;
     levelLength        = ggm.GetLevelLength();
     transform.position = new Vector3(levelLength, 0, 0);
 }