// This method takes passed in data and manipulates the health value. Damage is the amount of health lost or gained (negative values are healing) //and the ID is the character ID that is doing the damage. These are assigned to players by the boss on start. public void modifyHealth(float dam, int ID) { if (health > 0 && shielded) { if (gameObject.tag == "Player") { //dam *= 0; foundShield = GameObject.FindGameObjectWithTag("Shield"); foundShield.GetComponent <Health>().health -= dam; } //if (gameObject.tag == "Shield") //{ // health -=dam*GetComponent<ShieldScript>().playersInShield.Length; //} } else { health -= dam; } // If the target is an enemy, it will convert any damage done to it to threat, for targeting purposes. if (gameObject.tag == "Enemy") { BossTargetingAI threat = GetComponent <BossTargetingAI>(); threat.addThreat(dam, ID, false); } }
// At the start, initializes an array for each attack to have their own Cooldowns(CDs) // Also pulls targeting and movement information. // Hardcoded coodlown values for testing. Change or make variables (see below) void Start() { attackCDs = new float[4]; specialAttackCDs = new float[4]; tsunamiSpawns = new GameObject[4]; targeting = GetComponent <BossTargetingAI>(); range = GetComponent <BossMovementAI>(); anim = GetComponent <Animator>(); torso = GameObject.Find("Torso"); tsunamiObj = GameObject.Find("Mako Tsunami"); shockwaveObj = GameObject.Find("Adobe Shockwave"); tsunamiSpawns[0] = new GameObject("Tsunami Spawn"); tsunamiSpawns[0].transform.position = new Vector3(100, 0, 0); tsunamiSpawns[0].transform.rotation = Quaternion.Euler(0, -90, -90); tsunamiSpawns[1] = new GameObject("Tsunami Spawn"); tsunamiSpawns[1].transform.position = new Vector3(-100, 0, 0); tsunamiSpawns[1].transform.rotation = Quaternion.Euler(0, 90, -90); tsunamiSpawns[2] = new GameObject("Tsunami Spawn"); tsunamiSpawns[2].transform.position = new Vector3(0, 0, 100); tsunamiSpawns[2].transform.rotation = Quaternion.Euler(0, 180, -90); tsunamiSpawns[3] = new GameObject("Tsunami Spawn"); tsunamiSpawns[3].transform.position = new Vector3(0, 0, -100); tsunamiSpawns[3].transform.rotation = Quaternion.Euler(0, 0, -90); attackCDs[0] = 10; attackCDs[1] = 8; attackCDs[2] = 5; attackCDs[3] = 2; specialAttackCDs[0] = 10; specialAttackCDs[1] = 15; specialAttackCDs[2] = 10; specialAttackCDs[3] = .5f; scenelight = GameObject.Find("Directional Light"); health = GetComponent <Health>(); h2 = health.health; }
// Gets the targeting information from the BossTargetingAI script void Start() { targeting = GetComponent <BossTargetingAI>(); currentTarget = targeting.currentTarget; }
private void Update() { bossTargets = GameObject.Find("Boss").GetComponent <BossTargetingAI>(); }