Advertisement
Guest User

FormerHumanAI

a guest
Apr 9th, 2020
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class FormerHumanAI : EnemyAI
  6. {
  7.  
  8.     public static int Damage = 5;
  9.  
  10.     public void Update()
  11.     {
  12.         Debug.Log("Calling FormerHuman Update");
  13.         if (this.GetComponent<EnemyAI>().isFiring == true)
  14.         {
  15.             EnemyAttack();
  16.         }
  17.     }
  18.  
  19.     public override void EnemyAttack()
  20.     {
  21.         if (GlobalHealth.armor > 0)
  22.         {
  23.             Debug.Log("Dealing Armor Damage");
  24.             int adjustedDamage = (int)Mathf.Floor(Damage * .6f);
  25.             int armorDamage = Damage - adjustedDamage;
  26.             GlobalHealth.health -= adjustedDamage;
  27.             GlobalHealth.armor -= armorDamage;
  28.         }
  29.         else
  30.         {
  31.             Debug.Log("Dealing Regular Damage");
  32.             GlobalHealth.health -= Damage;
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement