1
This commit is contained in:
@@ -17,13 +17,19 @@ namespace BITFALL.AI.States
|
||||
public abstract class AIRuntimeState : AIState
|
||||
{
|
||||
[Inject,HideInInspector] public AIService Service;
|
||||
private readonly ConcurrentDictionary<ulong, bool> _friends = new();
|
||||
private readonly ConcurrentDictionary<ulong, bool> _enemies = new();
|
||||
private readonly ConcurrentDictionary<int, bool> _friends = new();
|
||||
private readonly ConcurrentDictionary<int, bool> _enemies = new();
|
||||
protected readonly HashSet<int> ignoreNoises = new();
|
||||
protected readonly CacheList<IEntity> detectedEnemies = new();
|
||||
protected readonly CacheList<IEntity> hearEnemies = new();
|
||||
public bool IsFriend(IEntity target) => _friends.GetOrAdd(target.Id, IsFriendInternal);
|
||||
public bool IsEnemy(IEntity target) => _enemies.GetOrAdd(target.Id, IsEnemyInternal);
|
||||
public bool IsFriend(IEntity target)
|
||||
{
|
||||
return _friends.GetOrAdd(target.Id, IsFriendInternal);
|
||||
}
|
||||
public bool IsEnemy(IEntity target)
|
||||
{
|
||||
return _enemies.GetOrAdd(target.Id, IsEnemyInternal);
|
||||
}
|
||||
public override void OnStateUpdate(float deltaTime)
|
||||
{
|
||||
base.OnStateUpdate(deltaTime);
|
||||
@@ -57,7 +63,7 @@ namespace BITFALL.AI.States
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsEnemyInternal(ulong id)
|
||||
private bool IsEnemyInternal(int id)
|
||||
{
|
||||
var target = UnityEntitiesService.Get(id);
|
||||
var tags = target.As<MonoBehaviour>().GetComponent<ITag>().GetTags();
|
||||
@@ -69,7 +75,7 @@ namespace BITFALL.AI.States
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsFriendInternal(ulong id)
|
||||
private bool IsFriendInternal(int id)
|
||||
{
|
||||
var target = UnityEntitiesService.Get(id);
|
||||
var tags = target.As<MonoBehaviour>().GetComponent<ITag>().GetTags();
|
||||
|
Reference in New Issue
Block a user