Ejemplo n.º 1
0
    /**
     * Updates flags to verify if the object can be considered landed or not and manages when can a new object be spawned
     */

    private void ObjectLanded()
    {
        // If a reference to an object exists, if this object if considered landed and if the game is not considered lost
        if (currentObject && currentObject.Landed() && !gameOver.gameOverFlag)
        {
            // Frees the reference holder of the 'current object'
            currentObject = null;

            // Calls for a new object to be spawned in 2 seconds
            spawnArea.SpawnNewObject(2f);

            // Adds a point to the current score
            score++;

            // If the current score exceeds the highest score registered for this session
            if (score > highestScore)
            {
                // Saves current score in highest
                highestScore = score;
            }

            // When the player reaches a score dividable by 5
            if (score % 5 == 0)
            {
                // Creates a new paper plane in the scene
                eventSpawnPoint.SpawnPaperPlane();
            }
        }
    }