|
|
|
|
|
|
FloorAHit, |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |