Beispiel #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerAbility ability = collision.GetComponent <PlayerAbility>();

        if (ability != null && ability.CanBePickedUp)
        {
            if (CurrentAbility != null)
            {
                CurrentAbility.DropAbility(ability.transform.position);
            }
            ability.PickupAbility(this);
            SoundPlayer.PlaySound(PlayerSound.Pickup);
            LevelManager.HighlightAbilityAnimation();
            CurrentAbility = ability;
        }
        else if (collision.tag == "Goal")
        {
            PausePlayerControls();
            LevelManager.CompleteLevel();
        }
    }