void InitUI() { UI = GameObject.Find("UI"); if (UI == null) { throw new System.Exception("Could not find UI GameObject. Make sure it's not missing in the scene"); } Transform bottomPanel = UI.transform.Find("BottomPanel"); EndTurnButton = bottomPanel.Find("EndTurnButton").gameObject; EndTurnButton.GetComponent <Button>().onClick.AddListener(delegate() { Controllers[CurrentControllerPlaying].GetComponent <TeamController>().EndTurn(); }); NextUnitButton = bottomPanel.Find("NextUnitButton").gameObject; NextUnitButton.GetComponent <Button>().onClick.AddListener(delegate() { Controllers[CurrentControllerPlaying].GetComponent <TeamController>().NextUnit(); }); FinishActionButton = bottomPanel.Find("FinishActionButton").gameObject; FinishActionButton.GetComponent <Button>().onClick.AddListener(delegate() { Controllers[CurrentControllerPlaying].GetComponent <TeamController>().FinishUnitAction(); }); CurrentControllerName = bottomPanel.Find("CurrentControllerName").gameObject; }
void UpdateUI() { bool human = Controllers[CurrentControllerPlaying].GetComponent <HumanTeamController>() != null ? true : false; EndTurnButton.GetComponent <Button>().interactable = human; //CurrentControllerName.GetComponent<TextMeshProUGUI>().text = Controllers[CurrentControllerPlaying].GetComponent<TeamController>().Name + " turn"; }
private void Update() { if (currentCardAction != null) { if (currentCardAction.IsActionFinished() == false) { currentCardAction.Update(); } } if (IsCardActionFinished() || !IsPlayerTurn()) { endTurnButton.GetComponent <Button>().interactable = true; } else { endTurnButton.GetComponent <Button>().interactable = false; } }