void OnTriggerEnter(Collider other) { if (other.tag == "Zombie") { if (zombies.ContainsKey(other)) { zombies[other] += 1; } else { zombies[other] = 1; } } if (other.tag == "Destructible") { if (destructibles.ContainsKey(other)) { destructibles[other] += 1; } else { destructibles[other] = 1; } } if (other.tag == "FootballZombie") { bossHealth = other.GetComponent <FootballZombieHealth>(); } }
// Use this for initialization void Start() { _player = GameObject.Find("Player").GetComponent <Player>(); _health = GetComponent <FootballZombieHealth>(); CC = GetComponent <CharacterController>(); curAnim = GetComponent <tk2dSpriteAnimator>(); FZSM = GetComponent <FootballZombieSM>(); }
void drawBossHealth() { if (boss) { FootballZombieHealth bossHealth = boss.GetComponent <FootballZombieHealth>(); float percent = bossHealth.health / (float)bossHealth.maxHealth; int ctrlKeysOffset = (int)stunKeyPosition.xMax; drawPercentBar(100 + ctrlKeysOffset, Screen.height - 75, Screen.width - 200 - ctrlKeysOffset, 50, percent, redBox, "Boss Health", 0, false); } }
void OnTriggerEnter(Collider other) { if(other.tag == "Zombie"){ if (zombies.ContainsKey(other)) { zombies[other] += 1; } else { zombies[other] = 1; } } if(other.tag == "Destructible"){ if (destructibles.ContainsKey(other)) { destructibles[other] += 1; } else { destructibles[other] = 1; } } if (other.tag == "FootballZombie") { bossHealth = other.GetComponent<FootballZombieHealth>(); } }
void OnTriggerExit(Collider other) { if (other.tag == "Zombie") { if (zombies.ContainsKey(other)) { zombies[other] -= 1; if (zombies[other] == 0) { zombies.Remove(other); } } else { Debug.LogError("removed a nonexistant zombie"); } } if (other.tag == "Destructible") { if (destructibles.ContainsKey(other)) { destructibles[other] -= 1; if (destructibles[other] == 0) { destructibles.Remove(other); } } else { Debug.LogError("removed a nonexistant destructible"); } } if (other.tag == "FootballZombie") { bossHealth = null; } }
// Use this for initialization void Start() { _player = GameObject.Find("Player").GetComponent<Player>(); _health = GetComponent<FootballZombieHealth>(); CC = GetComponent<CharacterController>(); curAnim = GetComponent<tk2dSpriteAnimator>(); FZSM = GetComponent<FootballZombieSM>(); }
void OnTriggerExit(Collider other) { if(other.tag == "Zombie"){ if (zombies.ContainsKey(other)) { zombies[other] -= 1; if (zombies[other] == 0) { zombies.Remove(other); } } else { Debug.LogError("removed a nonexistant zombie"); } } if(other.tag == "Destructible"){ if (destructibles.ContainsKey(other)) { destructibles[other] -= 1; if (destructibles[other] == 0) { destructibles.Remove(other); } } else { Debug.LogError("removed a nonexistant destructible"); } } if (other.tag == "FootballZombie") { bossHealth = null; } }