Exemple #1
0
        // Update is called once per frame
        protected void Update()
        {
            if (!levelCompleted)
            {
                UserInput userInput = input.GetInput();

                if (CharacterCoinController.CoinCount > 100)
                {
                    coinController.Reset();
                    character.AddLives(1);
                }

                if (character.IsDead & !characterDied)
                {
                    SoundGenerator soundGenerator = GameObject
                                                    .FindGameObjectsWithTag("MusicGenerator")[0]
                                                    .GetComponent <SoundGenerator>();

                    if (character.Health <= 0)
                    {
                        soundGenerator.PlayPlayerIsDead(true);
                    }
                    else
                    {
                        soundGenerator.PlayPlayerIsDead();
                    }

                    if (cameraController != null)
                    {
                        Destroy(this.cameraController);
                    }

                    characterDied = true;
                }

                character.Move(userInput.move, userInput.status);
            }
        }