Ejemplo n.º 1
0
    private void GameReset()
    {
        SetTimeScale(1f);
        GameObject.FindGameObjectsWithTag("Player").ToList().ForEach((obj) => GameObject.Destroy(obj));
        GameObject.FindGameObjectsWithTag("Enemy").ToList().ForEach((obj) => GameObject.Destroy(obj));
        currentPlayer        = GameObject.Instantiate(playerPrefab, Vector3.zero, Quaternion.identity);
        currentBezierSpawner = GameObject.Instantiate(bezierSpawnerPrefab, Vector3.zero, Quaternion.identity);
        var bezSpawnComp = currentBezierSpawner.GetComponent <BezierSpawner>();

        currentPlayer.GetComponent <PlayerInputComponent>().SetBezierSpawner(bezSpawnComp);
        currentPlayer.GetComponent <PlayerController>().SetBezierSpawner(bezSpawnComp);
        currentBezierSpawner.GetComponent <FollowTargetComponent>().SetTargetToFollow(currentPlayer.transform);
        spawners.ForEach((spwn) => {
            spwn.SetTarget(currentPlayer.transform);
            spwn.Reset();
        });
        Camera.main.transform.position = new Vector3(0, 0, -10);
        //TODO: Refactor with a property
        currentScore          = 0;
        currentScoreThreshold = scoreThreshold;
        hasWon = false;
        scoreChangeEvent.Invoke(currentScore);
        Camera.main.GetComponent <CameraController>().SetTransformToFollow(currentPlayer.transform);
        Camera.main.GetComponent <Animation>().Play("MenuAnimation");
        StartCoroutine(GetLeaderboard());
    }
Ejemplo n.º 2
0
    private IEnumerator KeepAddingScore()
    {
        for (int i = 0;; i++)
        {
            yield return(new WaitForSeconds(0.1f));

            OnScoreChange.Invoke(i);
        }
    }
Ejemplo n.º 3
0
 public void ChangeScore(double value)
 {
     Score = value;
     ScoreChangeEvent?.Invoke();
 }
Ejemplo n.º 4
0
 public void NotifyQuizEnd(int score)
 {
     OnQuizEnd.Invoke();
     OnScoreChange.Invoke(score);
 }
Ejemplo n.º 5
0
 public static void InvokeScoreChangeEvent(int point) => ScoreChangeEvent?.Invoke(point);
Ejemplo n.º 6
0
 public void UpdateScore()
 {
     OnScoreChange.Invoke(tempScore);
 }