Esempio n. 1
0
    public void LevelComplete()
    {
        _currentLevel++;
        Achievements.AchievementCheck();
        asteroidInfo.SetCurrentAsteroidCount();
        UIScript.SetLevelSettings(asteroidInfo.targetAsteroidCount, (int)asteroidInfo.targetChildCount);
        if (_currentLevel > 10)
        {
            RestartAfterTime(0);
            return;
        }
        CustomAnalytics.SendLevelStart(_currentLevel);
        onLevelComplete.Invoke();
        string tag = "Bullet";

        if (gameObject.DoesTagExist(tag))
        {
            foreach (GameObject bullet in GameObject.FindGameObjectsWithTag(tag))
            {
                Destroy(bullet);
            }
        }
        CreateAsteroids();

        _levelCompleteOneShot = false;
    }
Esempio n. 2
0
    public void StartLevel()
    {
        asteroidsSO.numSmallerAsteroidsToSpawn = levelsConfiguration[curLevel][4] - '0'; //get this from remote settings

        // Spawn the parent Asteroids, child Asteroids are taken care of by them
        for (int i = 0; i < levelsConfiguration[curLevel][2] - '0'; i++)
        {
            SpawnParentAsteroid(i);
        }

        curLevel++;
        if (curLevel >= AchievementManager.levelToReachSkillfullDodger && !AchievementManager.S.Achievements[5].complete)
        {
            HIGH_LEVEL_DELEGATE();
        }
        CustomAnalytics.SendLevelStart(curLevel);
    }
    void StartLevel(int levelNum)
    {
#if DEBUG_AsteraX_LogMethods
        Debug.Log("AsteraX:StartLevel(" + levelNum + ")");
#endif
        if (LEVEL_LIST.Count == 0)
        {
            Debug.LogError("AsteraX:StartLevel(" + levelNum + ") - LEVEL_LIST is empty!");
            return;
        }
        if (levelNum >= LEVEL_LIST.Count)
        {
            levelNum = 1; // Just loop the levels for now. In a real game, this would be different.
        }

        GAME_STATE = eGameState.preLevel;
        GAME_LEVEL = levelNum;
        LevelInfo info = LEVEL_LIST[levelNum - 1];

        // Destroy any remaining Asteroids, Bullets, etc. (including particle effects)
        ClearAsteroids();
        ClearBullets();
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("DestroyWithLevelChange"))
        {
            Destroy(go);
        }

        // Set up the asteroidsSO
        asteroidsSO.numSmallerAsteroidsToSpawn = info.numSubAsteroids;

        // Spawn the parent Asteroids, child Asteroids are taken care of by them
        for (int i = 0; i < info.numInitialAsteroids; i++)
        {
            SpawnParentAsteroid(i);
        }

        CustomAnalytics.SendLevelStart(GAME_LEVEL);
        AchievementManager.AchievementStep(Achievement.eStepType.levelUp, levelNum);
    }