Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject txt = GameObject.Find("Enemy2HP");

        enemy2HPText      = txt.GetComponent <Text>();
        enemy2HPText.text = "HP: " + Enemy2Script.getCurrentHP() + "/" + Enemy2Script.getMaxHP();
    }
Esempio n. 2
0
    }     //end onAttackButton

    public void onAttackButton2()
    {
        if (Enemy2Script.getCurrentHP() > 0)
        {
            int enemy2HPcurrent = Enemy2Script.getCurrentHP();

            //prints are for debugging
            print(enemy2HPcurrent);
            print(BattleTurn.playerAttackStat);
            print(Enemy2Script.getDefenseStat());


            Enemy2Script.setHP(enemy2HPcurrent - BattleTurn.playerAttackStat + Enemy2Script.getDefenseStat() - 10);

            enemy2HPcurrent = Enemy2Script.getCurrentHP();
            print(enemy2HPcurrent);
            BattleTurn.currentTurn++;

            enemySelectText.gameObject.SetActive(false);
        }        //end if
        else if (Enemy2Script.getCurrentHP() <= 0)
        {
            errorSound.Play();
            print("attack button 2");
        } //end if
    }     //end onAttackButton
Esempio n. 3
0
 // Update is called once per frame
 void Update()
 {
     if (EnemyScript.getCurrentHP() <= 0 && Enemy2Script.getCurrentHP() <= 0 && isOver == false)
     {
         battleTheme.Stop();
         victoryTheme.Play();
         wonText.SetActive(true);
         isOver = true;
     }   //end if
 }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        srenderer = GetComponent <SpriteRenderer>();

        if (enemy != null)
        {
            e  = enemy.GetComponent <EnemyScript>();
            e2 = enemy.GetComponent <Enemy2Script>();
        }
    }
Esempio n. 5
0
    }//end onElFireButton

    public void onElFireButton2()
    {
        didAttack = false;
        if (WarriorScript.getCurrentMP() >= 8 && BattleTurn.currentTurn % 4 == 0 && didAttack == false && Enemy2Script.getCurrentHP() > 0)
        {
            didAttack = true;
            int enemy2HPcurrent = Enemy2Script.getCurrentHP();

            //prints are for debugging
            print(enemy2HPcurrent);
            print(BattleTurn.playerMagicStat);
            print(Enemy2Script.getMagicStat());

            Enemy2Script.setHP(enemy2HPcurrent - BattleTurn.playerMagicStat + Enemy2Script.getMagicStat() - 15);

            enemy2HPcurrent = Enemy2Script.getCurrentHP();
            print(enemy2HPcurrent);

            WarriorScript.setMP(WarriorScript.getCurrentMP() - 8);

            BattleTurn.currentTurn++;
        }   //end if
        else if (BattleTurn.currentTurn % 4 == 0 && didAttack == false)
        {
            errorSound.Play();
            print("Elfire 2 button warrior");
        }        //end else if

        if (MageScript.getCurrentMP() >= 8 && BattleTurn.currentTurn % 4 == 1 && didAttack == false && Enemy2Script.getCurrentHP() > 0)
        {
            didAttack = true;
            int enemy2HPcurrent = Enemy2Script.getCurrentHP();

            //prints are for debugging
            print(enemy2HPcurrent);
            print(BattleTurn.playerMagicStat);
            print(Enemy2Script.getMagicStat());

            Enemy2Script.setHP(enemy2HPcurrent - BattleTurn.playerMagicStat + Enemy2Script.getMagicStat() - 15);

            enemy2HPcurrent = Enemy2Script.getCurrentHP();
            print(enemy2HPcurrent);

            MageScript.setMP(MageScript.getCurrentMP() - 8);

            BattleTurn.currentTurn++;
        }    //end if
        else if (BattleTurn.currentTurn % 4 == 1 && didAttack == false)
        {
            errorSound.Play();
            print("Elfire 2 button mage");
        }        //end else if
    }//end onElFireButton2
Esempio n. 6
0
    // Update is called once per frame
    void Update()
    {
        if (Enemy2Script.getCurrentHP() > 0)
        {
            enemy2HPText.text = "HP: " + Enemy2Script.getCurrentHP() + "/" + Enemy2Script.getMaxHP();
        }        //end if

        if (Enemy2Script.getCurrentHP() <= 0)
        {
            enemy2HPText.text = "HP: " + "0" + "/" + Enemy2Script.getMaxHP();
        }        //end if
    }
Esempio n. 7
0
    // Update is called once per frame
    void Update()
    {
        if (entity.GetComponent <PlayerMove>() != null)
        {
            PlayerMove pm = entity.GetComponent <PlayerMove>();

            if (dmg != null)
            {
                dmg.text = ((int)pm.damage).ToString();
            }

            fill.fillAmount = pm.health / pm.starting_health;

            if (pm.health <= 0)
            {
                death_message.enabled = true;
            }
        }

        if (entity.GetComponent <EnemyScript>() != null)
        {
            EnemyScript pm = entity.GetComponent <EnemyScript>();

            fill.fillAmount = pm.health / pm.max_health;

            if (pm.health <= 0)
            {
                death_message.enabled = true;
            }
        }

        if (entity.GetComponent <Enemy2Script>() != null)
        {
            Enemy2Script pm = entity.GetComponent <Enemy2Script>();

            fill.fillAmount = pm.health / pm.max_health;

            if (pm.health <= 0)
            {
                death_message.enabled = true;
            }
        }
    }
Esempio n. 8
0
 public void onBombButton2()
 {
     Enemy2Script.setHP(Enemy2Script.getCurrentHP() - 20);
     BattleTurn.currentTurn++;
 }
Esempio n. 9
0
    public void getTurn()
    {
        //if % = 0, then its Warrior turn
        if (currentTurn % 4 == 0)
        {
            playerAttackStat  = WarriorScript.getAttackStat();
            playerDefenseStat = WarriorScript.getDefenseStat();
            playerSpeedStat   = WarriorScript.getSpeedStat();
            playerMagicStat   = WarriorScript.getMagicStat();
            playerCurrentHP   = WarriorScript.getCurrentHP();
            playerMaxHP       = WarriorScript.getMaxHP();
            playerCurrentMP   = WarriorScript.getCurrentMP();
            playerMaxMP       = WarriorScript.getMaxMP();
        }        //end if

        //if % = 1, then its Mage turn
        if (currentTurn % 4 == 1)
        {
            playerAttackStat  = MageScript.getAttackStat();
            playerDefenseStat = MageScript.getDefenseStat();
            playerSpeedStat   = MageScript.getSpeedStat();
            playerMagicStat   = MageScript.getMagicStat();
            playerCurrentHP   = MageScript.getCurrentHP();
            playerMaxHP       = MageScript.getMaxHP();
            playerCurrentMP   = MageScript.getCurrentMP();
            playerMaxMP       = MageScript.getMaxMP();
        }        //end if

        //if % = 2, then its Enemy1 turn
        if (currentTurn % 4 == 2 && EnemyScript.getCurrentHP() > 0)
        {
            int randomTarget;
            randomTarget = Random.Range(1, 100);
            print(randomTarget);


            if (randomTarget <= 50)
            {
                WarriorScript.setHP(WarriorScript.getCurrentHP() - EnemyScript.getAttackStat() + WarriorScript.getDefenseStat() - 10);
            }            //end if
            if (randomTarget > 50)
            {
                MageScript.setHP(MageScript.getCurrentHP() - EnemyScript.getAttackStat() + MageScript.getDefenseStat() - 10);
            }    //end if
            currentTurn++;
        }        //end if
        else if (currentTurn % 4 == 2)
        {
            currentTurn++;
        }

        //if % = 3, then its Enemy2 turn
        if (currentTurn % 4 == 3 && Enemy2Script.getCurrentHP() > 0)
        {
            int randomTarget;
            randomTarget = Random.Range(1, 100);
            print(randomTarget);

            if (randomTarget <= 50)
            {
                WarriorScript.setHP(WarriorScript.getCurrentHP() - Enemy2Script.getAttackStat() + WarriorScript.getDefenseStat() - 10);
            }            //end if
            if (randomTarget > 50)
            {
                MageScript.setHP(MageScript.getCurrentHP() - Enemy2Script.getAttackStat() + MageScript.getDefenseStat() - 10);
            }    //end if
            currentTurn++;
        }        //end if
        else if (currentTurn % 4 == 3)
        {
            currentTurn++;
        }
    }//end getTurn