예제 #1
0
    void characterInputDone()
    {
        PerformList.Add(characterChoise);
        clearAttackPanel();

        charactersToManage.RemoveAt(0);
        characterInput = characterGUI.activate;
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (Gamemanager.instance.detectE == true)
        {
            enemysinBattle.AddRange(GameObject.FindGameObjectsWithTag("Enemy"));
            characterInput = characterGUI.activate;
            attackPanel.SetActive(false);
            EnemySelect.SetActive(false);
            SkillsPanel.SetActive(false);
            EnemyButtons();
            Gamemanager.instance.noEnemys = false;
            Gamemanager.instance.detectE  = false;
        }

        switch (battlestates)
        {
        case (performAction.wait):
            if (PerformList.Count > 0)
            {
                battlestates = performAction.takeaction;
            }
            break;

        case (performAction.takeaction):
            GameObject performer = GameObject.Find(PerformList [0].attacker);
            if (PerformList [0].Type == "Enemy")
            {
                EnemyStateMachine ESM = performer.GetComponent <EnemyStateMachine> ();
                for (int i = 0; i < charactersinBattle.Count; i++)
                {
                    if (PerformList [0].attackersTarget == charactersinBattle [i])
                    {
                        ESM.charactertoattack = PerformList [0].attackersTarget;
                        ESM.currentState      = EnemyStateMachine.TurnState.action;
                        break;
                    }
                    else
                    {
                        PerformList[0].attackersTarget = charactersinBattle[Random.Range(0, charactersinBattle.Count)];
                        ESM.charactertoattack          = PerformList [0].attackersTarget;
                        ESM.currentState = EnemyStateMachine.TurnState.action;
                    }
                }
            }
            if (PerformList [0].Type == "Player c")
            {
                HeroStateMachine HSM = performer.GetComponent <HeroStateMachine> ();
                HSM.enemytoAttack = PerformList [0].attackersTarget;
                HSM.currentState  = HeroStateMachine.TurnState.action;
            }
            battlestates = performAction.performaction;
            break;

        case (performAction.performaction):
            //idle
            break;

        case (performAction.checkAlive):
            if (charactersinBattle.Count < 1)
            {
                battlestates = performAction.lose;
                //lose
            }
            else if (enemysinBattle.Count < 1)
            {
                Gamemanager.instance.noEnemys = true;
                battlestates = performAction.win;
                //win
            }
            else
            {
                clearAttackPanel();
                characterInput = characterGUI.activate;
                battlestates   = performAction.wait;
            }
            break;

        case (performAction.lose):
        {
            Debug.Log("lose");
        }
        break;

        case (performAction.win):
        {
            Debug.Log("win");
            for (int i = 0; i < charactersinBattle.Count; i++)
            {
                charactersinBattle[i].GetComponent <HeroStateMachine>().currentState = HeroStateMachine.TurnState.waiting;
            }
            battlestates = performAction.wait;
        }
        break;
        }
        switch (characterInput)
        {
        case (characterGUI.activate):
            if (charactersToManage.Count > 0)
            {
                characterChoise = new HandleTurn();

                attackPanel.SetActive(true);

                CreateAttackButtons();
                characterInput = characterGUI.waiting;
            }
            break;

        case (characterGUI.waiting):
            //Idle
            break;

        case (characterGUI.done):
            characterInputDone();
            break;
        }
    }
예제 #3
0
 public void Input2(GameObject choosenEnemy)    //enemy selection
 {
     characterChoise.attackersTarget = choosenEnemy;
     characterInput = characterGUI.done;
 }