|
|
|
|
|
|
FloorBHit |
|
|
|
} |
|
|
|
|
|
|
|
FloorHit m_LastFloorHit; |
|
|
|
[HideInInspector] |
|
|
|
public FloorHit lastFloorHit; |
|
|
|
|
|
|
|
TennisArea m_Area; |
|
|
|
TennisAgent m_AgentA; |
|
|
|
|
|
|
|
|
|
|
public void ResetPoint() |
|
|
|
{ |
|
|
|
m_LastFloorHit = FloorHit.Service; |
|
|
|
lastFloorHit = FloorHit.Service; |
|
|
|
m_LastAgentHit = -1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
if (collision.gameObject.name == "wallA") |
|
|
|
{ |
|
|
|
// Agent A hits into wall or agent B hit a winner
|
|
|
|
if (m_LastAgentHit == 0 || m_LastFloorHit == FloorHit.FloorAHit) |
|
|
|
if (m_LastAgentHit == 0 || lastFloorHit == FloorHit.FloorAHit) |
|
|
|
{ |
|
|
|
AgentBWins(); |
|
|
|
} |
|
|
|
|
|
|
else if (collision.gameObject.name == "wallB") |
|
|
|
{ |
|
|
|
// Agent B hits into wall or agent A hit a winner
|
|
|
|
if (m_LastAgentHit == 1 || m_LastFloorHit == FloorHit.FloorBHit) |
|
|
|
if (m_LastAgentHit == 1 || lastFloorHit == FloorHit.FloorBHit) |
|
|
|
{ |
|
|
|
AgentAWins(); |
|
|
|
} |
|
|
|
|
|
|
else if (collision.gameObject.name == "floorA") |
|
|
|
{ |
|
|
|
// Agent A hits into floor, double bounce or service
|
|
|
|
if (m_LastAgentHit == 0 || m_LastFloorHit == FloorHit.FloorAHit || m_LastFloorHit == FloorHit.Service) |
|
|
|
if (m_LastAgentHit == 0 || lastFloorHit == FloorHit.FloorAHit || lastFloorHit == FloorHit.Service) |
|
|
|
m_LastFloorHit = FloorHit.FloorAHit; |
|
|
|
lastFloorHit = FloorHit.FloorAHit; |
|
|
|
if (m_LastAgentHit == 1 || m_LastFloorHit == FloorHit.FloorBHit || m_LastFloorHit == FloorHit.Service) |
|
|
|
if (m_LastAgentHit == 1 || lastFloorHit == FloorHit.FloorBHit || lastFloorHit == FloorHit.Service) |
|
|
|
m_LastFloorHit = FloorHit.FloorBHit; |
|
|
|
lastFloorHit = FloorHit.FloorBHit; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
m_LastAgentHit = 0; |
|
|
|
m_LastFloorHit = FloorHit.FloorHitUnset; |
|
|
|
lastFloorHit = FloorHit.FloorHitUnset; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (collision.gameObject.name == "AgentB") |
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
m_LastAgentHit = 1; |
|
|
|
m_LastFloorHit = FloorHit.FloorHitUnset; |
|
|
|
lastFloorHit = FloorHit.FloorHitUnset; |
|
|
|
} |
|
|
|
} |
|
|
|
} |