Example #1
0
    void Update()
    {
        if (active == NormalState && inFight) //  normal to fight
        {
            mainUI.SetActive(false);
            FightCameraEnable();

            RandomEnemy();
            SpawnPlayerTeam();
            UILink.instance.SetInstanceMemberPanel(teamPosition);
            SpawnEnemyTeam();
            RandomFightFirst();
            whoPlayNow = queuePlay.Peek();

            if (whoPlayNow.Who == "player") //ถึงคืว
            {
                PlayerTeamCanAttack(true);
                BotTeamCanAttack(false);
            }
            else if (whoPlayNow.Who == "bot")
            {
                BotTeamCanAttack(true);
                PlayerTeamCanAttack(false);
            }

            CameraAnimation.instance.MoveToBack();

            active = (state)(FightState);
            active();
        }
        else if (active == NormalState && !inFight) //  normal to normal
        {
            active = (state)(NormalState);
            active();
        }
        else if (active == FightState && inFight) //  fight to fight
        {
            active = (state)(FightState);
            active();
        }
        else if (active == FightState && !inFight) //  fight to normal
        {
            NormalCameraEnable();
            CameraAnimation.instance.MoveToFront();
            ClearFightState();

            mainUI.SetActive(true);

            active = (state)(NormalState);
            active();
        }
    }
Example #2
0
    public void NextQueue()
    {
        queuePlay.Dequeue();
        queuePlay.Enqueue(whoPlayNow);
        whoPlayNow = queuePlay.Peek();

        Debug.Log("Queue: " + whoPlayNow.Who);

        if (whoPlayNow.Who == "player")
        {
            PlayerTeamCanAttack(true);
            BotTeamCanAttack(false);
        }
        else if (whoPlayNow.Who == "bot")
        {
            BotTeamCanAttack(true);
            PlayerTeamCanAttack(false);
        }
        else
        {
            Debug.LogError("Queue Error: " + whoPlayNow.Who);
        }
    }