This commit is contained in:
Alex38Lyon
2025-06-03 12:00:47 +02:00
parent ed8041abcd
commit 878ea46cac
1300 changed files with 527178 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
using UnityEngine;
namespace Unity.FPS.Game
{
// 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 each other")]
public int Affiliation;
[Tooltip("Represents point where other actors will aim when they attack this actor")]
public Transform AimPoint;
ActorsManager m_ActorsManager;
void Start()
{
m_ActorsManager = GameObject.FindFirstObjectByType<ActorsManager>();
DebugUtility.HandleErrorIfNullFindObject<ActorsManager, Actor>(m_ActorsManager, this);
// Register as an actor
if (!m_ActorsManager.Actors.Contains(this))
{
m_ActorsManager.Actors.Add(this);
}
}
void OnDestroy()
{
// Unregister as an actor
if (m_ActorsManager)
{
m_ActorsManager.Actors.Remove(this);
}
}
}
}