Beispiel #1
0
    public void StartWorld()
    {
        timer.StopTimer();
        timer.ResetTimer();

        rotation.canRotate = false;

        rotation.Reset();

        player.Disable();

        entry.transform.position = player.transform.position;

        foreach (var s in shrinkingTiles)
        {
            s.Reset();
        }

        if (teleports != null && teleports.Length > 0)
        {
            foreach (var t in teleports)
            {
                t.Reset();
            }
        }


        StartCoroutine(ScaleTeleport());
        StartCoroutine(SpawnPlayer());
    }
Beispiel #2
0
    private void PlayerLostAllLives()
    {
        levelTimer.StopTimer();

        ChangeGameState(GameState.GameOver);
        CoreConnector.GameManager.gameVariables.StoreTotalBricksBroken();

        var playersFinalScore = CoreConnector.GameManager.scoreManager.playerScore;

        // not doing with the players final score. But here it is!
        Debug.Log("players final score:" + playersFinalScore);

        CoreConnector.UIManager.DisplayScreen(UIScreens.GameOver);
    }
Beispiel #3
0
 public void LoadLevel()
 {
     if (_canvasType == CanvasType.LevelEnd)
     {
         _levelTimer.StopTimer();
     }
     SceneManager.LoadScene(_levelToLoad);
 }
Beispiel #4
0
 public void LevelFinished()
 {
     if (timer.enoughTime)
     {
         ShowVictoryMenu();
     }
     else
     {
         ShowGameOverMenu();
     }
     timer.StopTimer();
 }
Beispiel #5
0
    /*
     * Desc: Stops the level -- Stops the timer and stops spawning gophers, also destroys any that were left in the scene
     */
    private void EndLevel()
    {
        // Set end level screen, disable gameplay screen
        //screenGamePlay.SetActive(false);
        screenEnd.SetActive(true);

        // Disable gameplay cursor
        gameplayCursor.SetActive(false);

        _levelTimer.StopTimer();
        StopSpawningGophers();
    }
 void Die()
 {
     agent.enabled = false;
     //gameObject.layer = 9;  this is supposed to make the monster walkable after it dies
     //gameObject.GetComponentInChildren<GameObject>().layer = 9;
     StopCoroutine(fight);
     StopCoroutine(chase);
     StartCoroutine(Death());
     dontRotate = true;
     time       = timer.StopTimer();
     anim.SetBool("isDead", true);
 }
        void Update()
        {
            if (activeSpawner.allWavesDestroyed)
            {
                GameControl.instance.player.LevelProgress = 100;
                timer.StopTimer();
            }
            if (AlienShooter.GameControl.instance.player.LevelProgress >= 100 && !gameOverLoaded)
            {
                gameOverLoaded = true;
                StartCoroutine(EndLevel());
            }
            timer.UpdateTimer();
//			GameControl.instance.player.LevelTime = timer.ToString();
            GameControl.instance.player.LevelTimeMilliseconds = timer.millisecondsPassed;
        }
Beispiel #8
0
 private void OnLevelTimerTicked()
 {
     currentTimer -= 1;
     if (currentTimer <= 1)
     {
         if (TimerOneSecLeft != null)
         {
             TimerOneSecLeft();
         }
     }
     if (currentTimer <= 0)
     {
         timer.StopTimer();
         CheckIfLevelCompleted();
     }
     Debug.Log("currentTimer " + currentTimer);
 }
Beispiel #9
0
    // Update is called once per frame
    void Update()
    {
        if (startedScaling)
        {
            player.transform.position = transform.position;
            return;
        }
        else if (reachedByPlayer)
        {
            Vector2 to      = transform.position - player.transform.position;
            float   dist    = to.magnitude;
            Vector3 heading = to / dist;

            player.rigidbody2d.isKinematic = true;
            player.rigidbody2d.velocity    = Vector2.zero;

            if (!startedScaling && dist < 0.15f)
            {
                levelTimer.StopTimer();

                if (onGoalReached != null)
                {
                    onGoalReached();
                }



                startedScaling = true;
                StartCoroutine(ScaleGoal());
                StartCoroutine(ScalePlayer());
            }
            else
            {
                player.transform.position += heading * attractionForce * Time.deltaTime;
            }
        }
    }