public void OnResponse(IResponse[] ResponseChain) { switch (tickState) { case TickState.AwaitingResponses: ResponsesRecieved++; // LogStack.Log ("ResponseChain Length: " + ResponseChain.Length, LogLevel.Stack); if (ResponseChain.Length > 0) { // LogStack.Log ("Awaiting Responses, " + ResponsesRecieved + " Players ready", LogLevel.Stack); if (ResponseChain[0].player == TournamentManager._instance.P1) { P1 = ResponseChain; } else { P2 = ResponseChain; } } if (ResponsesRecieved == 2) { ResponsesRecieved = 0; tickState = TickState.PerformingResponses; OnResponse(null); } break; case TickState.ValidateResponses: // LogStack.Log ("Validate Responses | TODO", LogLevel.Stack); //AIResponseManager.Move/Attack/Spawn validate | use code //for loop of the response chain double checks everthing is good // if all good go to TickState.PerformingResponses // if a problem send fail event and go back to TickState.AwaitingResponses: tickState = TickState.PerformingResponses; break; case TickState.PerformingResponses: LogStack.Log("Performing Responses", LogLevel.Stack); if (P1 != null && P2 != null) { alternateTurns = !alternateTurns; if (alternateTurns) { StartCoroutine(PerformActions(P1.Concat(P2).ToArray())); } else { StartCoroutine(PerformActions(P2.Concat(P1).ToArray())); } } else if (P1 != null) { StartCoroutine(PerformActions(P1)); } else { StartCoroutine(PerformActions(P2)); } // stagger out perform phase based on wait times from tournament manager // step to TickState.FireTick: break; case TickState.FireTick: // LogStack.Log ("Fire Tick", LogLevel.Stack); // restart the loop // eject states for win lose conditions // ResponsesRecieved++; // if (ResponsesRecieved == 2) { // ResponsesRecieved = 0; tickState = TickState.AwaitingResponses; TournamentManager._instance.OnTick.Invoke(TournamentManager._instance.lanes.ToArray()); P1 = new IResponse[0]; P2 = new IResponse[0]; // } break; default: break; } }