Scriptum/Assets/Scripts/REFACTORING/Application/Tools/RespownTrigger.cs
2022-12-29 21:04:25 +01:00

42 lines
779 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
[RequireComponent(typeof(FollowingEnemy))]
class RespownTrigger : MonoBehaviour
{
public GameObject CoreRespowner;
public bool wasKilled = false;
public void Start()
{
}
public void Update()
{
if(gameObject.GetComponent<FollowingEnemy>().isKilled == 1 && !wasKilled)
{
wasKilled = true;
MarkAsKilled();
}
}
public void SetParentRespowner(GameObject parentRespowner)
{
CoreRespowner = parentRespowner;
}
public void MarkAsKilled()
{
CoreRespowner.GetComponent<CounterRespowner>().killedMinions += 1;
}
}