|
|
|
|
|
|
} |
|
|
|
item.Agent.EndEpisode(); |
|
|
|
} |
|
|
|
|
|
|
|
//Reset Agents
|
|
|
|
foreach (var item in AgentsList) |
|
|
|
{ |
|
|
|
var pos = UseRandomAgentPosition ? GetRandomSpawnPos() : item.StartingPos; |
|
|
|
var rot = UseRandomAgentRotation ? GetRandomRot() : item.StartingRot; |
|
|
|
|
|
|
|
item.Agent.transform.SetPositionAndRotation(pos, rot); |
|
|
|
item.Rb.velocity = Vector3.zero; |
|
|
|
item.Rb.angularVelocity = Vector3.zero; |
|
|
|
item.Col.enabled = true; |
|
|
|
item.Agent.frozen = false; |
|
|
|
item.Agent.gameObject.SetActive(true); |
|
|
|
item.Rb.constraints &= ~RigidbodyConstraints.FreezePositionY; |
|
|
|
} |
|
|
|
|
|
|
|
//Reset Blocks
|
|
|
|
foreach (var item in BlocksList) |
|
|
|
{ |
|
|
|
|
|
|
// Freeze block's motion until zombies are killed
|
|
|
|
item.Rb.constraints |= RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionZ; |
|
|
|
item.Rb.constraints |= RigidbodyConstraints.FreezeRotationY; |
|
|
|
} |
|
|
|
|
|
|
|
//Reset Agents
|
|
|
|
foreach (var item in AgentsList) |
|
|
|
{ |
|
|
|
var pos = UseRandomAgentPosition ? GetRandomSpawnPos() : item.StartingPos; |
|
|
|
var rot = UseRandomAgentRotation ? GetRandomRot() : item.StartingRot; |
|
|
|
|
|
|
|
item.Agent.transform.SetPositionAndRotation(pos, rot); |
|
|
|
item.Rb.velocity = Vector3.zero; |
|
|
|
item.Rb.angularVelocity = Vector3.zero; |
|
|
|
item.Col.enabled = true; |
|
|
|
item.Agent.frozen = false; |
|
|
|
item.Agent.gameObject.SetActive(true); |
|
|
|
item.Rb.constraints &= ~RigidbodyConstraints.FreezePositionY; |
|
|
|
} |
|
|
|
|
|
|
|
//End Episode
|
|
|
|