Almost Final Version
This commit is contained in:
@ -8,8 +8,8 @@ public class GameManager : MonoBehaviour
|
||||
private static GameManager _instance;
|
||||
public static GameManager Instance => _instance;
|
||||
|
||||
private static SimpleMultiAgentGroup _defendersTeam = new SimpleMultiAgentGroup();
|
||||
private static SimpleMultiAgentGroup _attackersTeam = new SimpleMultiAgentGroup();
|
||||
public static SimpleMultiAgentGroup _defendersTeam = new SimpleMultiAgentGroup();
|
||||
public static SimpleMultiAgentGroup _attackersTeam = new SimpleMultiAgentGroup();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@ -27,16 +27,6 @@ public class GameManager : MonoBehaviour
|
||||
Academy.Instance.OnEnvironmentReset += ResetScene;
|
||||
GlobalEventManager.OnCaptureFlag += FlagCaptured;
|
||||
GlobalEventManager.OnTimeLeft += TimeOut;
|
||||
|
||||
var agents = GameObject.FindObjectsOfType<Agent>();
|
||||
foreach (var item in agents)
|
||||
{
|
||||
var agent = item as NPC;
|
||||
if (agent.GetCharacter.Team == Team.Attackers)
|
||||
_attackersTeam.RegisterAgent(item);
|
||||
else
|
||||
_defendersTeam.RegisterAgent(item);
|
||||
}
|
||||
}
|
||||
|
||||
private static SimpleMultiAgentGroup GetAgentList(Team team)
|
||||
@ -91,17 +81,19 @@ public class GameManager : MonoBehaviour
|
||||
public static List<GameObject> GetVisibleEnemies(Team oppositeTeam, Vector3 position)
|
||||
{
|
||||
var agentGroup = GetAgentList(oppositeTeam);
|
||||
var enemies = new List<GameObject>();
|
||||
|
||||
RaycastHit rayHit = new RaycastHit();
|
||||
foreach (var agent in agentGroup.GetRegisteredAgents() )
|
||||
{
|
||||
var npc = agent as NPC;
|
||||
if (Physics.Raycast(position,
|
||||
if (npc != null && Physics.Raycast(position,
|
||||
(npc.NpcBodyState.GetPointToHit(npc.gameObject) - position).normalized,
|
||||
out rayHit,
|
||||
SettingsReader.Instance.GetSettings.ViewDistance))
|
||||
{
|
||||
if (rayHit.collider.gameObject.GetComponent<ICharacter>() != null)
|
||||
return null;
|
||||
enemies.Add(rayHit.collider.gameObject);
|
||||
}
|
||||
}
|
||||
if ((SettingsReader.Instance.GetSettings.HasHumanAttacker == true && oppositeTeam == Team.Attackers) ||
|
||||
@ -114,10 +106,10 @@ public class GameManager : MonoBehaviour
|
||||
SettingsReader.Instance.GetSettings.ViewDistance))
|
||||
{
|
||||
if (rayHit.collider.gameObject.GetComponent<ICharacter>() != null)
|
||||
return null;
|
||||
enemies.Add(rayHit.collider.gameObject);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return enemies;
|
||||
}
|
||||
|
||||
private void FlagCaptured(Team team)
|
||||
@ -133,7 +125,6 @@ public class GameManager : MonoBehaviour
|
||||
ResetScene();
|
||||
break;
|
||||
}
|
||||
ResetScene();
|
||||
}
|
||||
|
||||
private void TimeOut()
|
||||
|
@ -25,7 +25,6 @@ public class MapManager : MonoBehaviour
|
||||
for (var i=0; i < count; i++)
|
||||
NavPoints.Add(navPointSet.transform.GetChild(i)
|
||||
.gameObject.GetComponent<NavPoint>());
|
||||
print(NavPoints.Count);
|
||||
NavPointSetToID();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user