Example #1
0
    void Update()
    {
        if (state == MainState.Over || IsEffecting)
        {
            return;
        }

        if (state == MainState.AgentThinking)
        {
            if (gameMode == GameMode.Agent)
            {
                if (Agent.State == PlayerAgent.StateEnum.Complete)
                {
                    statusUI.ShowTimecost(Agent.GetCostTime());
                    state = MainState.AgentRunning;
                }
            }
        }
        if (state == MainState.AgentRunning)
        {
            if (gameMode == GameMode.Agent)
            {
                if (DoAgentAction())
                {
                    state = MainState.AgentEffectWaiting;
                }
            }
        }
        else if (state == MainState.AgentEffectWaiting)
        {
            NextTurn();
        }
        else
        {
            var point = GameInfo.Instance.mainCamera.ScreenToWorldPoint(Input.mousePosition);
            if (board.gameObject.GetComponent <Collider2D>() == Physics2D.OverlapPoint(point))
            {
                MouseEvent(point);
            }
        }
    }