Exemplo n.º 1
0
    public static void GameOver()
    {
        Analytics.CustomEvent("GameOver", new Dictionary <string, object>
        {
            { "Score", i.scoreCtrl.GetCurrentScore() },
            { "Speed", DifficultyManager.GetCurrentMovementSpeed() },
            { "SpawnRate", DifficultyManager.GetCurrentSpawnRate() },
            { "ShapeAmmount", ShapeController.GetShapeAmmount() }
        });

        i.OnGameEnd?.Invoke();
    }
    private IEnumerator SpawnShapeCoroutine(ShapeScriptable _firstShape)
    {
        yield return(new WaitForSeconds(startDelayTime));

        while (true)
        {
            ShapeScriptable shapeToSpawn;
            if (nextShape != null)
            {
                shapeToSpawn = nextShape;
                nextShape    = null;

                yield return(new WaitForSeconds(0.7f));
            }
            else if (_firstShape != null)
            {
                shapeToSpawn = _firstShape;
                _firstShape  = null;
            }
            else
            {
                int shapeToGuess = spawnedShapes.Count(s => s.IsToGuess());
                if (ShapeController.CheckNextShapeToAdd(shapeToGuess))
                {
                    yield return(null);

                    continue;
                }

                shapeToSpawn = ShapeController.GetRandomShapeMatch();
            }

            SpawnShape(shapeToSpawn);

            yield return(new WaitForSeconds(DifficultyManager.GetCurrentSpawnRate()));
        }
    }