Seascape/Assets/Scripts/Fisch/FishPoints2.cs

34 lines
776 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FishPoints2 : MonoBehaviour
{
GameObject Fisch2;
public PlayerScript playerScript;
AudioManager audioManager;
private void Awake()
{
audioManager = GameObject.FindGameObjectWithTag("Audio").GetComponent<AudioManager>();
}
private void OnTriggerEnter2D(Collider2D kaputt)
{
FishPoints2 Fish = kaputt.GetComponent<FishPoints2>();
if (Fish != null)
{
GetCollected();
}
}
public void GetCollected()
{
if (Fisch2 != null)
{
Destroy(Fisch2);
audioManager.PlaySFX(audioManager.Fisch);
playerScript.Fisch2Collected = true;
}
}
}