Exemplo n.º 1
0
    public void InitialiseWithLevelKey(string levelKey)
    {
        Reset();

        levelConfig   = LevelKeyHandler.ReadKey(levelKey);
        this.levelKey = LevelKeyHandler.GenerateKey(levelConfig);
        levelConfig.includedSkills.Add(Player.Skill.Jump);

        unusableChunks.AddRange(chunks);
        if (levelConfig.includeTutorialChunks)
        {
            // Only have jump tutorial as first chunk
            foreach (GameObject chunk in unusableChunks)
            {
                Chunk chunkDetails = chunk.GetComponent <Chunk>();
                if (chunkDetails.tutorialChunk &&
                    chunkDetails.includedSkills.Count == 1 &&
                    chunkDetails.includedSkills.Contains(Player.Skill.Jump) &&
                    chunkDetails.version <= levelConfig.version)
                {
                    usableChunks.Add(chunk);
                }
            }
            if (usableChunks.Count <= 0)
            {
                throw new Exception("No tutorial jump chunk provided");
            }
        }
        else
        {
            // Go straight to getting all the chunks that we can use, since we don't need to teach the player to jump first
            UpdateUsableChunks();
        }
    }
Exemplo n.º 2
0
    public void TransitionToPlayState()
    {
        gameState = GameState.Play;
        ChunkSpawner.GetInstance().InitialiseWithLevelKey(LevelKeyHandler.GenerateKey(levelInputConfig));
        Player.GetInstance().ResetHealth();
        Player.GetInstance().ResetTooltips();
        scoreManager.ResetScore();
        scoreManager.StartCounting();

        // make paper sheets fly in play direction
        var fol = paperSheets.forceOverLifetime;

        fol.xMultiplier = -ChunkSpawner.GetInstance().levelConfig.speed;

        // make foreground grass start moving
        parallaxBackground.backgroundSpeeds[11] = ChunkSpawner.GetInstance().levelConfig.speed / 15;

        gameMusicInstance.setParameterByID(isPlayStateParameterId, 1);
    }
Exemplo n.º 3
0
 public void UpdateLevelInputKey()
 {
     levelInputKeyText.text = LevelKeyHandler.GenerateKey(levelInputConfig);
 }