Example #1
0
 // creo una funzione void  che chiamo input 2  e chiederĂ  un gameObject
 public void Input2(GameObject choseEnemy)
 {
     //imposto l'attack targer al chosenEnemy
     HeroChoice.AttacksTarget = choseEnemy;
     //imposto l'HeroInput a done
     HeroInput = HeroGUI.Done;
 }
Example #2
0
 public void defendSelect()
 {
     HerosToManage[0].GetComponent <HeroStateMachine>().currentState = HeroStateMachine.TurnState.DEFENDING;
     HerosToManage.RemoveAt(0);
     attackPanel.SetActive(false);
     HeroInput = HeroGUI.ACTIVATE;
 }
Example #3
0
    //Filling handle turn info with the attackers target
    public void InputTwo(GameObject chosenEnemy)
    {
        heroChoice.AttackersTarget = chosenEnemy;

        //starts the next case
        heroInput = HeroGUI.DONE;
    }
Example #4
0
    public void Input2(GameObject chosenEnemy)
    {
        HeroChoice.AttackersTarget = chosenEnemy;
        HeroInput = HeroGUI.Done;

        //EnemySelectPanel.SetActive(false);
    }
Example #5
0
    public void SelectTarget(GameObject choosenEnemy)
    {
        PlaySound(SoundType.ITEM_USED);

        heroChoice.AttackersTarget = choosenEnemy;
        HeroInput = HeroGUI.DONE;
    }
    public List <GameObject> enemiesButtons = new List <GameObject>(); // List of enemmies buttons for the attack panel

    private void Start()
    {
        actionsPanel.SetActive(false);
        enemySelectPanel.SetActive(false);
        activePanel = actionsPanel;

        battleState = PerformAction.WAIT;
        heroInput   = HeroGUI.ACTIVATE;

        enemiesInBattle.AddRange(GameObject.FindGameObjectsWithTag("Enemy"));
        heroesInBattle.AddRange(GameObject.FindGameObjectsWithTag("Hero"));

        //Assign the center of the battleground to all enemies and players
        foreach (GameObject enemy in enemiesInBattle)
        {
            EnemyStateMachine ESM = enemy.GetComponent <EnemyStateMachine>();
            ESM.centerOfTheBattleground = centerOfTheBattleground;
        }
        foreach (GameObject hero in heroesInBattle)
        {
            PlayerStateMachine PSM = hero.GetComponent <PlayerStateMachine>();
            PSM.centerOfTheBattleground = centerOfTheBattleground;
        }

        EnemyButtons();
    }
 /// <summary>
 /// Selects all enemies
 /// </summary>
 public void AllEnemiesSelectionInput()
 {
     heroChoice.targets = enemiesInBattle;
     heroesToManage[0].GetComponent <PlayerStateMachine>().enemiesToAttack = enemiesInBattle;
     heroesToManage[0].GetComponent <PlayerStateMachine>().isAreaAttack    = true;
     heroInput = HeroGUI.DONE;
 }
Example #8
0
 // Start is called before the first frame update
 void Start()
 {
     //uso la funzione set active Per impostare TestoCura a false
     testoCura.SetActive(false);
     // uso la funzione addRange per aggiungere tutti i player alla lista Heros in game
     HerosInGame.AddRange(GameObject.FindGameObjectsWithTag("Player"));
     //uso la funzione set active Per impostare Testo a false
     testo.SetActive(false);
     //setto il timer a 0
     timer = 0;
     //rendo libero il cursore
     Cursor.lockState = CursorLockMode.None;
     // rendo visibile il cursore
     Cursor.visible = true;
     //imposto il battleState a wait
     BattleState = PerformAction.Wait;
     // imposto L'hero input a activate
     HeroInput = HeroGUI.Activate;
     //uso la funzione set active Per impostare AttackPanel a false
     AttackPanel.SetActive(false);
     //uso la funzione set active Per impostare EnemySelectPanel a false
     EnemySelectPanel.SetActive(false);
     //uso la funzione set active Per impostare MagicsPanel a false
     MagicsPanel.SetActive(false);
     // chiamo la funzione enemyButtons
     EnemyButtons();
 }
    public void Input7(ItemStats item)//choosen magic attack
    {
        float temp1 = HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.curHP + item.amountOfHpToGive;
        float temp2 = HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.curMP + item.amountOfMpToGive;

        if (temp1 > HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.baseHP)
        {
            HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.curHP = HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.baseHP;
        }
        else
        {
            HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.curHP = temp1;
        }
        if (temp2 > HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.baseMP)
        {
            HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.curMP = HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.baseMP;
        }
        else
        {
            HeroesToManage[0].GetComponent <HeroStateMachine>().playerStats.curMP = temp2;
        }
        ItemPanel.SetActive(false);
        itemUsed  = true;
        HeroInput = HeroGUI.DONE;
    }
Example #10
0
 void HeroInputDone()
 {
     PerformList.Add(HeroTurn);
     enemySelectPanel.SetActive(false);
     HerosToManage[0].transform.Find("Selector").gameObject.SetActive(false);
     HerosToManage.RemoveAt(0);
     HeroInput = HeroGUI.ACTIVATE;
 }
 /// <summary>
 /// Steps after the character finishes selecting an action
 /// </summary>
 void HeroInputDone()
 {
     actionsInTurn.Add(heroChoice);
     ClearAttackPanel();
     heroesToManage[0].transform.Find("Selector").gameObject.SetActive(false);
     heroesToManage.RemoveAt(0);
     heroInput = HeroGUI.ACTIVATE;
 }
Example #12
0
 void HeroInputDone()
 {
     PerformList.Add(HeroChoice);
     EnemySelectPanel.SetActive(false);
     HerosToManage[0].transform.Find("Selector").gameObject.SetActive(false);
     HerosToManage.RemoveAt(0);
     HeroInput = HeroGUI.Activate;
 }
Example #13
0
 void heroInputDone()
 {
     performList.Add(heroChoice);
     enemySelectPanel.SetActive(false);
     heroesToManage[0].transform.FindChild("Selector").gameObject.SetActive(false);
     heroesToManage.RemoveAt(0);
     heroInput = HeroGUI.ACTIVATE;
 }
Example #14
0
 public void Input2()
 {
     HeroChoice.AttackersTarget = EnemiesInBattle[0];//Random.Range(0, EnemiesInBattle.Count)];
     // PerformList.Add(HeroChoice);
     // HerosToManage.RemoveAt(0);
     // Debug.Log("Ive been removed");
     HeroInput = HeroGUI.ACTIVATE;
 }
Example #15
0
 public void HeroInputDone()
 {
     PerformList.Add(HeroChoice);
     EnemySelectPanel.SetActive(false);
     SkillPanel.SetActive(false);
     AttackPanel.SetActive(false);
     HeroesToManage.RemoveAt(0);
     HeroInput = HeroGUI.ACTIVATE;
 }
 void HeroInputDone()
 {
     PerformList.Add(HeroChoice);
     clearAttackPanel();
     //nuconteazaundeva
     HerosToManage[0].transform.Find("Selector").gameObject.SetActive(false);
     HerosToManage.RemoveAt(0);
     HeroInput = HeroGUI.ACTIVATE;
 }
    public void HeroInputDone() // Completed Hero Input and sending info to the perform list plus removing hero from HerosToManage
    {
        PerformList.Add(HeroChoice);
        targetPanel.SetActive(false);

        HerosToManage[0].transform.Find("Selector").gameObject.SetActive(false);
        HerosToManage.RemoveAt(0);
        HeroInput = HeroGUI.ACTIVATE;
    }
Example #18
0
    //
    void heroInputDone()
    {
        m_performList.Add(m_herosChoice);

        clearAttackPanel();

        m_heroToManage.RemoveAt(0);
        m_heroInput = HeroGUI.ACTIVATE;
    }
 // Adds player characters to turn list,
 // deactivates character selection,
 // moves on to next PC,
 // and resets action GUI
 private void HeroInputDone()
 {
     PerformList.Add(heroChoice);
     EnemySelectPanel.SetActive(false);
     HerosToManage[0].transform.Find("Selector").gameObject.SetActive(false);
     HerosToManage.RemoveAt(0);
     HeroInput = HeroGUI.ACTIVATE;
     Debug.Log("HeroInputDone");
 }
Example #20
0
    public void Input1() //attack button should be able to call this automatically
    {
        HeroChoice.Attacker            = HerosToManage[0].name;
        HeroChoice.AttackingGameObject = HerosToManage[0];
        HeroChoice.Type = "Hero";
        int num = Random.Range(0, HerosToManage[0].GetComponent <HerroStateMachine>().hero.attacks.Count);

        HeroChoice.choosenAttack = HerosToManage[0].GetComponent <HerroStateMachine>().hero.attacks[num];
        HeroInput = HeroGUI.INPUT2;
    }
    void HeroInputDone()
    {
        PerformList.Add(HeroChoice);

        //clear the panel
        clearAttackPanel();

        HeroesToManage.RemoveAt(0);
        HeroInput = HeroGUI.ACTIVATE;
    }
Example #22
0
    void HeroInputDone()
    {
        PerformList.Add(HeroChoise);
        //clean the attack panel
        ClearAttackPanel();

        HerosToManage[0].transform.Find("Selector").gameObject.SetActive(false);
        HerosToManage.RemoveAt(0);
        HeroInput = HeroGUI.Activate;
    }
Example #23
0
    public void HeroInputDone()
    {
        performList.Add(heroChoise);
        enemySelectPanel.SetActive(false);
        ClearAttackButton();

        heroesToManage[0].transform.Find("Selector").gameObject.SetActive(false);
        heroesToManage.RemoveAt(0);
        heroInput = HeroGUI.ACTIVATE;
    }
 /// <summary>
 /// Selects a simple enemy
 /// </summary>
 /// <param name="enemyToAttack">enemy to attack</param>
 public void UniqueEnemySelectionInput(GameObject enemyToAttack)
 {
     heroChoice.targets = new List <GameObject>
     {
         enemyToAttack
     };
     heroesToManage[0].GetComponent <PlayerStateMachine>().enemyToAttack = enemyToAttack;
     heroesToManage[0].GetComponent <PlayerStateMachine>().isAreaAttack  = false;
     heroInput = HeroGUI.DONE;
 }
Example #25
0
    public void Input2(GameObject chosenTarget)//enemy selection
    {
        HeroChoice.AttackersTarget = chosenTarget;

        if (HeroChoice.chosenAttack.abilityType == "Attack" && HeroChoice.AttackersTarget.GetComponent <EnemyStateMachine>().taunt > 0)
        {
            HeroChoice.AttackersTarget.GetComponent <HeroStateMachine>().taunt--;
        }

        HeroInput = HeroGUI.DONE;
    }
Example #26
0
    //public GameObject attackPanel;
    //public GameObject enemySelectPanel;

    //this is for enemybutton if needed

    // public GameObject enemyButton;
    //public Transform spacer;

    void Start()
    {
        battleStates = PerformAction.WAIT;
        EnemiesInBattle.AddRange(GameObject.FindGameObjectsWithTag("Enemy"));
        HerosInBattle.AddRange(GameObject.FindGameObjectsWithTag("Hero"));
        HerosToManage.AddRange(GameObject.FindGameObjectsWithTag("Hero"));
        HeroInput = HeroGUI.ACTIVATE;
        //attackpanel.setactive(false);
        //enemySelectPanel.Setactive(false);
        //EnemyButtons();
    }
Example #27
0
    // Update is called once per frame
    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")
            {
                EnemyStateMachine ESM = performer.GetComponent <EnemyStateMachine>();
                ESM.targetToAttack = performList[0].targetOfAttacker;
                ESM.currentState   = EnemyStateMachine.TurnState.ACTION;
            }
            if (performList[0].type == "Hero")
            {
                HeroStateMachine HSM = performer.GetComponent <HeroStateMachine>();
                HSM.targetToAttack = performList[0].targetOfAttacker;
                HSM.currentState   = HeroStateMachine.TurnState.ACTION;
            }
            battleStates = PerformAction.PERFORMACTION;
            break;

        case (PerformAction.PERFORMACTION):

            break;
        }

        switch (heroInput)
        {
        case (HeroGUI.ACTIVATE):
            if (heroesToManage.Count > 0)
            {
                heroesToManage[0].transform.FindChild("Selector").gameObject.SetActive(true);
                heroChoice = new TurnHandler();
                attackPanel.SetActive(true);
                heroInput = HeroGUI.WAITING;
            }
            break;

        case (HeroGUI.WAITING):
            //idle
            break;

        case (HeroGUI.DONE):
            heroInputDone();
            break;
        }
    }
    void Update()
    {
        switch (battleStates)
        {
        case (PerformAction.Wait):
            if (PerformList.Count > 0)
            {
                battleStates = PerformAction.ActionTake;
            }
            break;

        case (PerformAction.ActionTake):
            GameObject performer = PerformList[0].AttacksGameObject;
            if (PerformList[0].Type == "Enemy")
            {
                EnemyStateMachine ESM = performer.GetComponent <EnemyStateMachine>();
                ESM.HeroToAttack = PerformList[0].AttackersTarget;
                ESM.currentState = EnemyStateMachine.TurnState.Action;
            }
            if (PerformList[0].Type == "Hero")
            {
                HeroStateMachine HSM = performer.GetComponent <HeroStateMachine>();
                HSM.EnemyToAttack = PerformList[0].AttackersTarget;
                HSM.currentState  = HeroStateMachine.TurnState.Action;
            }
            battleStates = PerformAction.ActionPerform;
            break;

        case (PerformAction.ActionPerform):
            //Idle
            break;
        }

        switch (HeroInput)
        {
        case (HeroGUI.Activate):
            if (HeroesToManage.Count > 0)
            {
                //FIXME HeroesToManage[0].transform.Find("Selector").gameObject.SetActive(true);
                HeroChoice = new HandleTurn();
                attackPanel.SetActive(true);
                HeroInput = HeroGUI.Wait;
            }
            break;

        case (HeroGUI.Wait):
            //Idle
            break;

        case (HeroGUI.Done):
            HeroInputDone();
            break;
        }
    }
Example #29
0
    void Start()
    {
        battleStates = PerformAction.WAIT;
        EnemysInBattle.AddRange(GameObject.FindGameObjectsWithTag("Enemy"));
        HerosInBattle.AddRange(GameObject.FindGameObjectsWithTag("Hero"));
        HeroInput = HeroGUI.ACTIVATE;

        AttackPanel.SetActive(false);
        EnemySelectPanel.SetActive(false);

        EnemyButtons();
    }
Example #30
0
    // Use this for initialization
    void Start()
    {
        attackPanel.SetActive(false);
        enemySelectPanel.SetActive(false);

        battleStates = PerformAction.WAIT;
        enemiesInBattle.AddRange(GameObject.FindGameObjectsWithTag("Enemy"));
        playersInBattle.AddRange(GameObject.FindGameObjectsWithTag("Player"));
        heroInput = HeroGUI.ACTIVATE;

        EnemyButtons();
    }