/// <summary> /// Gives or takes control from the current turnhandler activate true means to activate current turnhandler, /// also counts down the planning time activate false means to deactivate current turnhandler. /// </summary> void ActivateTurnHandler(bool activate) { //TurnOnColliders(); turnHandler1.gameObject.SetActive(true); turnHandler2.gameObject.SetActive(true); if (activate) { //gives control to the current turnhandler if (currentActiveTurnhandler == turnHandler1 && !isTH1Done) { turnHandler1.Activate(true); countDownPlanningTime = StartCoroutine(CountDownPlanningTime()); //make sure to deactivate the other one turnHandler2.Activate(false); } else if (currentActiveTurnhandler == turnHandler2 && !isTH2Done) { turnHandler2.Activate(true); countDownPlanningTime = StartCoroutine(CountDownPlanningTime()); //make sure to deactivate the other one turnHandler1.Activate(false); } } else { turnHandler1.Activate(false); turnHandler2.Activate(false); } }
void Start() { if (customIsServer) { playerTurnhandler = rightTurnhandlerInScene; otherTurnhandler = leftTurnhandlerInScene; } else { playerTurnhandler = leftTurnhandlerInScene; otherTurnhandler = rightTurnhandlerInScene; } inGameMenuHandler.SetActive(true); ingameCanvas.SetActive(true); matchmakingCanvas.SetActive(false); playerTurnhandler.gameObject.SetActive(true); playerTurnhandler.currentPlanTimeLeft = planTime; otherTurnhandler.gameObject.SetActive(true); playingField.SetActive(true); robotDeselectionCollider.SetActive(true); ball.gameObject.SetActive(true); InititializeGame(); //activate the playeturnhandler only playerTurnhandler.Activate(true); planCountDownCoroutine = StartCoroutine(CountDownPlanningTime()); }