29 lines
656 B
C#
29 lines
656 B
C#
using UnityEngine;
|
|
|
|
public class EnemyDepositStation : MonoBehaviour
|
|
{
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
TeamMember teamMember = other.GetComponent<TeamMember>();
|
|
|
|
if (teamMember == null)
|
|
return;
|
|
|
|
if (teamMember.CurrentTeam == TeamMember.Team.PlayerTeam)
|
|
return;
|
|
|
|
CashManager cash = other.GetComponent<CashManager>();
|
|
|
|
if (cash == null || cash.currentCash <= 0)
|
|
return;
|
|
|
|
SimpleTeamAI ai =
|
|
other.GetComponent<SimpleTeamAI>();
|
|
|
|
if (ai != null)
|
|
{
|
|
ai.StartDepositEffect();
|
|
ai.StartDeposit(15f);
|
|
}
|
|
}
|
|
} |