39 lines
997 B
C#
39 lines
997 B
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class EnemyController : OrbitalPositionBehaviour
|
|
{
|
|
private static readonly List<EnemyController> Instances = new();
|
|
|
|
public static void KillAllEnemies()
|
|
{
|
|
foreach (EnemyController controller in Instances)
|
|
{
|
|
Destroy(controller.gameObject);
|
|
PlayerController.s_PlayerScore++;
|
|
}
|
|
|
|
Instances.Clear();
|
|
}
|
|
|
|
protected override void OnStart()
|
|
{
|
|
Instances.Add(this);
|
|
|
|
transform.position = new Vector3(0, 0, -200f);
|
|
|
|
m_OrbitalPosition.m_DistanceAlongRadius = Random.Range(0f, Mathf.PI * 2f);
|
|
m_OrbitalPosition.m_ObjectRadius = 0.1f;
|
|
m_OrbitalPosition.m_SpinSpeed = 0.7f;
|
|
}
|
|
|
|
public override void OnReachCentre()
|
|
{
|
|
if (GlobalOrbitalPositionManager.s_IsSimulationRunning)
|
|
PlayerController.s_PlayerScore++;
|
|
|
|
Instances.Remove(this);
|
|
Destroy(gameObject);
|
|
}
|
|
}
|