|
|
|
|
|
|
public bool UseRandomBlockPosition = true; |
|
|
|
PushBlockSettings m_PushBlockSettings; |
|
|
|
|
|
|
|
private SimpleMultiAgentGroup m_AgentGroup; |
|
|
|
|
|
|
|
private int m_NumberOfRemainingBlocks; |
|
|
|
|
|
|
|
void Start() |
|
|
|
|
|
|
// Starting material
|
|
|
|
m_GroundMaterial = m_GroundRenderer.material; |
|
|
|
m_PushBlockSettings = FindObjectOfType<PushBlockSettings>(); |
|
|
|
m_AgentGroup = new SimpleMultiAgentGroup(); |
|
|
|
foreach (var item in BlocksList) |
|
|
|
{ |
|
|
|
item.StartingPos = item.T.transform.position; |
|
|
|
|
|
|
item.Rb = item.Agent.GetComponent<Rigidbody>(); |
|
|
|
item.Col = item.Agent.GetComponent<Collider>(); |
|
|
|
// Add to team manager
|
|
|
|
// item.Agent.SetTeamManager(m_TeamManager);
|
|
|
|
m_AgentGroup.RegisterAgent(item.Agent); |
|
|
|
} |
|
|
|
foreach (var item in ZombiesList) |
|
|
|
{ |
|
|
|
|
|
|
//Give Agent Rewards
|
|
|
|
foreach (var item in AgentsList) |
|
|
|
{ |
|
|
|
m_AgentGroup.AddGroupReward(score); |
|
|
|
item.Agent.AddReward(score); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
public void ZombieTouchedBlock() |
|
|
|
{ |
|
|
|
//Give Agent Rewards
|
|
|
|
foreach (var item in AgentsList) |
|
|
|
{ |
|
|
|
item.Agent.AddReward(-1); |
|
|
|
} |
|
|
|
m_AgentGroup.AddGroupReward(-1); |
|
|
|
// Swap ground material for a bit to indicate we scored.
|
|
|
|
StartCoroutine(GoalScoredSwapGroundMaterial(m_PushBlockSettings.failMaterial, 0.5f)); |
|
|
|
ResetScene(); |
|
|
|