private void CreateLifeUp() { if (!FindObjectOfType <PowerUp>() && !usedPowerup) { SpawnPowerup(1); } if (lives.GetLives() > initialLives) { usedPowerup = true; curStage = TutorialState.SPEEDUP; StartCoroutine(SwapStages(4f)); } }
//Will load back to menu screen and grab all data from the current scene before transitioning if not tutorial public void LoadMenu(MenuState state) { float wait = 6f; if (isGame) { currentLevel += 1; ScoreController score = FindObjectOfType <ScoreController>(); LivesController lives = FindObjectOfType <LivesController>(); currentScore = score.GetScore(); currentLives = lives.GetLives(); wait = 3f; } isGame = false; sceneLoader = FindObjectOfType <SceneLoader>(); currentMenu = state; sceneLoader.LoadMenu(wait); }
// Start is called before the first frame update void Start() { curStage = TutorialState.START; enemies = FindObjectsOfType <EnemyController>(); barriers = FindObjectsOfType <DestructibleBarrier>(); enemyGroup = FindObjectOfType <EnemyGroupController>(); player = FindObjectOfType <PlayerControl>(); lives = FindObjectOfType <LivesController>(); session = FindObjectOfType <GameSession>(); session.SetGame(false); initialLives = lives.GetLives(); initialSpeed = player.moveSpeed; initialProjectileSpeed = player.projectileSpeed; totalEnemies = enemies.Length; totalBarriers = barriers.Length; DeactivateObjects(); DeactivateStages(); }