示例#1
0
 public void PlayerAttack()
 {
     if (Monster.getHealth() > 0 && showText)
     {
         if (PlayerCharacter.getAttack() > Monster.getDefense())
         {
             damage    = PlayerCharacter.getAttack() - Monster.getDefense();
             newHealth = Monster.getHealth() - damage;
             Monster.setHealth(newHealth);
             monsterHealth = "Enemy Health: " + Monster.getHealth();
         }
     }
     else if (SecurityCharacter.getHealth() > 0 && showMiniBossText)
     {
         if (PlayerCharacter.getAttack() > SecurityCharacter.getDefense())
         {
             damage    = PlayerCharacter.getAttack() - SecurityCharacter.getDefense();
             newHealth = SecurityCharacter.getHealth() - damage;
             SecurityCharacter.setHealth(newHealth);
             miniBossHealth = "Enemy Health: " + SecurityCharacter.getHealth();
         }
     }
     else if (BossCharacter.getHealth() > 0 && showBossText)
     {
         if (PlayerCharacter.getAttack() > BossCharacter.getDefense())
         {
             damage    = PlayerCharacter.getAttack() - BossCharacter.getDefense();
             newHealth = BossCharacter.getHealth() - damage;
             BossCharacter.setHealth(newHealth);
             bossHealth = "Boss Health: " + BossCharacter.getHealth();
         }
     }
 }
示例#2
0
 public void Flee()
 {
     cams[1].enabled  = false;
     cams[0].enabled  = true;
     cams[0].depth    = Camera.main.depth + 1;
     showText         = false;
     showMiniBossText = false;
     Monster.setHealth(10);
     if (SecurityCharacter.getHealth() > 0)
     {
         SecurityCharacter.setHealth(20);
     }
     monsterHealth = "Enemy Health: " + Monster.getHealth();
     PlayerCharacter.setHealth(PlayerCharacter.getMaxHealth());
     pcHealth = "Player Health: " + PlayerCharacter.getHealth();
 }
示例#3
0
    void Update()
    {
        originalHealth = PlayerCharacter.getMaxHealth();

        if (cams[1].isActiveAndEnabled)
        {
            if (cams[1].transform.position == miniBossCam.transform.position)
            {
                showMiniBossText = true;
            }
            else if (cams[1].transform.position == gunBossCam.transform.position ||
                     cams[1].transform.position == bossCam.transform.position)
            {
                showBossText = true;
            }
            else
            {
                showText = true;
            }
        }

        if (PlayerCharacter.getHealth() <= 0)
        {
            MainScreen.onMenu = true;
            cams[1].enabled   = false;
            cams[0].enabled   = true;
            cams[0].depth     = Camera.main.depth + 1;

            cams[0].transform.position = mainMenu.transform.position;
            showText         = false;
            wonBattle        = false;
            showMiniBossText = false;
            showBossText     = false;
            Monster.setHealth(10);
            SecurityCharacter.setHealth(20);
            BossCharacter.setHealth(30);
        }


        if (Monster.getHealth() <= 0 && showText)
        {
            cams[1].enabled = false;
            cams[0].enabled = true;
            cams[0].depth   = Camera.main.depth + 1;
            showText        = false;
            wonBattle       = true;
            Monster.setHealth(10);
            monsterHealth = "Enemy Health: " + Monster.getHealth();

            PlayerCharacter.setHealth(PlayerCharacter.getMaxHealth());
            pcHealth = "Player Health: " + PlayerCharacter.getHealth();
        }
        else if (SecurityCharacter.getHealth() <= 0 && showMiniBossText)
        {
            cams[1].enabled  = false;
            cams[0].enabled  = true;
            cams[0].depth    = Camera.main.depth + 1;
            showMiniBossText = false;
            wonBattle        = true;

            PlayerCharacter.setHealth(PlayerCharacter.getMaxHealth());
            PlayerCharacter.setItem(true);
            pcHealth = "Player Health: " + PlayerCharacter.getHealth();
        }
        else if (BossCharacter.getHealth() <= 0 && showBossText)
        {
            cams[1].enabled            = false;
            cams[0].enabled            = true;
            cams[0].depth              = Camera.main.depth + 1;
            cams[0].transform.position = mainMenu.transform.position;
            showBossText      = false;
            wonBattle         = false;
            MainScreen.onMenu = true;

            PlayerCharacter.setHealth(PlayerCharacter.getMaxHealth());
            pcHealth = "Player Health: " + PlayerCharacter.getHealth();
        }
    }