-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathSpectateEnemiesAPI.cs
30 lines (27 loc) · 1.09 KB
/
SpectateEnemiesAPI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using UnityEngine;
namespace SpectateEnemy
{
public class SpectateEnemiesAPI
{
/// <summary>
/// Returns true if Spectate Enemies is loaded and ready
/// </summary>
public static bool IsLoaded => SpectateEnemies.Instance != null;
/// <summary>
/// Returns true if the player is currently spectating an enemy
/// </summary>
public static bool IsSpectatingEnemies => SpectateEnemies.Instance.SpectatingEnemies;
/// <summary>
/// Gets the <see cref="GameObject"></see> of the enemy that the player is currently spectating.
/// </summary>
/// <returns>The parent <see cref="GameObject"/> of the enemy if the player is spectating an enemy, otherwise null</returns>
public static GameObject CurrentEnemySpectating()
{
if (IsSpectatingEnemies && SpectateEnemies.Instance.SpectatedEnemyIndex > -1)
{
return SpectateEnemies.Instance.SpectatorList[SpectateEnemies.Instance.SpectatedEnemyIndex].gameObject;
}
return null;
}
}
}