Esempio n. 1
0
 void HeroInputDone()
 {
     Debug.Log("Done");
     //値を返す
     performList.Add(HeroChoise);
     //Panelclear
     clearAttackPanel();
     //selector off
     HerosToManage[0].transform.Find("Selector").gameObject.SetActive(false);
     //ListRemove
     HerosToManage.RemoveAt(0);
     //実行
     HeroInput = HeroGuI.ACTIVATE;
 }
Esempio n. 2
0
    void Start()
    {
        //バトル待機
        battleStates = PerformAction.WAIT;

        //heroとEnemyの数を追加
        HerosInBattle.AddRange(GameObject.FindGameObjectsWithTag("Hero"));
        EnemyInBattle.AddRange(GameObject.FindGameObjectsWithTag("Enemy"));

        //GUIActive設定
        HeroInput = HeroGuI.ACTIVATE;

        AttackPanel.SetActive(false);
        EnemySelectPanel.SetActive(false);
        MagicPanel.SetActive(false);
        EnemyButtons();
    }
Esempio n. 3
0
    void HeroInputDone()
    {
        Debug.Log("Done");
        //値を返す
        performList.Add(HeroChoise);
        //HeroGUI off
        EnemySelectPanel.SetActive(false);

        //clean the attackPanel
        foreach (GameObject atkBtn in atkBtns)
        {
            Destroy(atkBtn);
        }
        atkBtns.Clear();

        //selector off
        HerosToManage[0].transform.Find("Selector").gameObject.SetActive(false);
        //ListRemove
        HerosToManage.RemoveAt(0);
        //実行
        HeroInput = HeroGuI.ACTIVATE;
    }
Esempio n. 4
0
    void Update()
    {
        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")
            {
                EnemyStateMaschine ESM = performer.GetComponent <EnemyStateMaschine>();
                for (int i = 0; i < HerosInBattle.Count; i++)
                {
                    if (performList[0].AttackerTarget == HerosInBattle[i])
                    {
                        ESM.HeroToAttack = performList[0].AttackerTarget;
                        ESM.currnetState = EnemyStateMaschine.TurnState.ACTION;
                        break;
                    }
                    else
                    {
                        performList[0].AttackerTarget = HerosInBattle[Random.Range(0, HerosInBattle.Count)];
                        ESM.HeroToAttack = performList[0].AttackerTarget;
                        ESM.currnetState = EnemyStateMaschine.TurnState.ACTION;
                    }
                }
                ESM.HeroToAttack = performList[0].AttackerTarget;
                ESM.currnetState = EnemyStateMaschine.TurnState.ACTION;
            }

            if (performList[0].Type == "Hero")
            {
                Debug.Log("Hero is hero to perform");
                HeroStateMaschine HSM = performer.GetComponent <HeroStateMaschine>();
                HSM.EnemyToAttack = performList[0].AttackerTarget;
                HSM.currnetState  = HeroStateMaschine.TurnState.ACTION;
            }

            battleStates = PerformAction.PERFORMACTION;
            break;

        case (PerformAction.PERFORMACTION):
            //Idle
            break;

        case (PerformAction.CHECKALIVE):
            if (HerosInBattle.Count < 1)
            {
                battleStates = PerformAction.LOSE;
                //lose game
            }
            else if (EnemyInBattle.Count < 1)
            {
                battleStates = PerformAction.WIN;
                //win game
            }
            else
            {
                //call funcion
                clearAttackPanel();
                HeroInput = HeroGuI.ACTIVATE;
            }
            break;

        case (PerformAction.LOSE):
        {
            Debug.Log("You Lost the Battle");
        }
        break;

        case (PerformAction.WIN):
        {
            Debug.Log("You Win the Battle");
            for (int i = 0; i < HerosInBattle.Count; i++)
            {
                HerosInBattle[i].GetComponent <HeroStateMaschine>().currnetState = HeroStateMaschine.TurnState.WAITING;
            }
        }
        break;
        }

        switch (HeroInput)
        {
        case (HeroGuI.ACTIVATE):
            if (HerosToManage.Count > 0)
            {
                //選択したheroにselector表示
                HerosToManage[0].transform.Find("Selector").gameObject.SetActive(true);
                HeroChoise = new HandleTurn();

                //GUIActive
                AttackPanel.SetActive(true);

                CreateAttackButton();
                HeroInput = HeroGuI.WAITING;
            }
            break;

        case (HeroGuI.WAITING):
            //待機
            break;

        case (HeroGuI.DONE):
            HeroInputDone();
            break;
        }
    }
Esempio n. 5
0
 //敵選択
 public void Input2(GameObject choosenEnemy)
 {
     HeroChoise.AttackerTarget = choosenEnemy;
     HeroInput = HeroGuI.DONE;
 }