Seascape/Assets/Netz_1Script.cs

70 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Netz_1Script : MonoBehaviour
{
public GameObject Netz1;
public GameObject Fisch1;
public Transform fishPoint;
[SerializeField] public int life = 2;
[SerializeField] private int dmg = 1;
public void TakeDamage()
{
life -= dmg;
if (life == 0)
{
Destroy(Netz1);
Instantiate(Fisch1);
}
}
}
public class Netz_2Script : MonoBehaviour
{
public GameObject Netz2;
public GameObject Fisch2;
public Transform fishPoint;
[SerializeField] public int life = 2;
[SerializeField] private int dmg = 1;
public void TakeDamage()
{
life -= dmg;
if (life == 0)
{
Destroy(Netz2);
Instantiate(Fisch2);
}
}
}
public class Netz_3Script : MonoBehaviour
{
public GameObject Netz3;
public GameObject Fisch3;
public Transform fishPoint;
[SerializeField] public int life = 2;
[SerializeField] private int dmg = 1;
public void TakeDamage()
{
life -= dmg;
if (life == 0)
{
Destroy(Netz3);
Instantiate(Fisch3);
}
}
}