-
Notifications
You must be signed in to change notification settings - Fork 0
/
Actor.cs
36 lines (32 loc) · 1.25 KB
/
Actor.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
31
32
33
34
35
36
using UnityEngine;
// This class contains general information describing an actor (player or enemies).
// It is mostly used for AI detection logic and determining if an actor is friend or foe
public class Actor : MonoBehaviour
{
//[Tooltip("Represents the affiliation (or team) of the actor. Actors of the same affiliation are friendly to eachother")]
public int affiliation;
//Represents point where other actors will aim when they attack this actor
public Transform aimPoint;
//this is for the advanced character controller in an FPS game
ActorsManager m_ActorsManager;
private void Start()
{
//here the actor manager takes the game object for example the player or the enemy
m_ActorsManager = GameObject.FindObjectOfType<ActorsManager>();
DebugUtility.HandleErrorIfNullFindObject<ActorsManager, Actor>(m_ActorsManager, this);
// Register as an actor
//here the actor is put into the empty Plot
if (!m_ActorsManager.actors.Contains(this))
{
m_ActorsManager.actors.Add(this);
}
}
private void OnDestroy()
{
// Unregister as an actor
if (m_ActorsManager)
{
m_ActorsManager.actors.Remove(this);
}
}
}