update scripts

This commit is contained in:
2022-04-25 16:23:25 +07:00
parent e1d0bbc1eb
commit 290f5515b7
13 changed files with 120 additions and 47 deletions

View File

@ -51,6 +51,20 @@ public class GameManager : MonoBehaviour
return false;
}
public static bool IsEnemyNearby(Vector3 currentTransform, Team team)
{
SimpleMultiAgentGroup agentGroup;
if (team == Team.Attackers)
agentGroup = AttackersTeam;
else
agentGroup = DefendersTeam;
foreach (var agent in agentGroup.GetRegisteredAgents())
if ((currentTransform - agent.transform.position).magnitude < SettingsReader.Instance.GetSettings.ViewDistance)
return true;
return false;
}
public static bool IsCloserToFlagFromNextNavPoint(NavPoint navPoint, Vector3 currentTransform)
=> navPoint.FlagDistance < (currentTransform - GameObject.FindGameObjectWithTag("Flag").transform.position).magnitude;