You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
457 B
C#
24 lines
457 B
C#
using D2D;
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
using static D2D.Utilities.CommonGameplayFacade;
|
|
|
|
public class Obstacle : Unit
|
|
{
|
|
public Action OnDespawn;
|
|
|
|
private void Update()
|
|
{
|
|
if (Vector3.Distance(transform.position, _formation.transform.position) > _gameData.ObstacleDespawnDistance)
|
|
{
|
|
Despawn();
|
|
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
private void Despawn()
|
|
{
|
|
OnDespawn?.Invoke();
|
|
}
|
|
} |