//Spawns the boss (and does the other things) for the current room private IEnumerator SpawnTheBoss(GameObject CurrentRoom) { BaseBoss Boss = CurrentRoom.GetComponentInChildren <BaseBoss>(true); GameObject BossObject = Boss.gameObject; string BossName = BossObject.GetComponent <BaseBoss>().BossName; Sprite BossSprite = BossObject.GetComponent <BaseBoss>().BossSprite; //Get the Boss Sprite and the Boss Name to draw on the screen Canvas.GetComponent <PlayerUI>().BossFightScreenCoroutine(BossSprite, BossName); Canvas.GetComponent <PlayerUI>().ShowTheBossHealthBar(); yield return(new WaitForSeconds(4.1f)); //Enable the player, and then enable the boss PlayerTransform.GetComponent <Player>().PlayerCanShoot = true; PlayerTransform.GetComponent <Player>().PlayerCanMove = true; Boss.gameObject.GetComponent <BaseBoss>().enabled = true; }
private void OnTriggerEnter2D(Collider2D collision) { //if the detected collider is an enemy projectile... if (collision.gameObject.GetComponentInChildren <BaseEnemyProjectile>() != null) { //if the projectile detected is invulnerable.. if (collision.gameObject.tag == "Invulnerable") { m_count = 0; //TrashMan.spawn("VFX_HIT_INVULNERABLE", transform.position, transform.rotation); //AudioPlays(); } else { m_count = 0; TrashMan.spawn("VFX_HIT_PLAYER", transform.position, transform.rotation); UbhObjectPool.Instance.ReleaseGameObject(collision.transform.parent.gameObject); } TrashMan.despawn(gameObject); } //if the detected collider is the boss if (collision.gameObject.GetComponent <BaseBoss>() != null) { BaseBoss boss = collision.gameObject.GetComponent <BaseBoss>(); boss.TakeDamage(m_damage); TrashMan.spawn("VFX_HIT_PLAYER", transform.position, transform.rotation); m_count = 0; TrashMan.despawn(gameObject); } //if the detected collider is the enemy if (collision.gameObject.GetComponent <BaseEnemy>() != null) { BaseEnemy enemy = collision.gameObject.GetComponent <BaseEnemy>(); enemy.TakeDamage(m_damage); TrashMan.spawn("VFX_HIT_PLAYER", transform.position, transform.rotation); m_count = 0; TrashMan.despawn(gameObject); } }
public void OnCollision(GameObject other) { if (other is BaseBoss) { BaseBoss boss1 = other as BaseBoss; boss1.LoseLifes(10); boss1.GetHit(); DestroyBullet(); } if (other is TylerSprite) { TylerSprite tyler = other as TylerSprite; Console.WriteLine("HIT"); tyler.Hit = true; } if (other is KanyeSprite) { KanyeSprite kanye = other as KanyeSprite; Console.WriteLine("HIT"); kanye.Hit = true; } }
public HUD_Boss(BaseBoss boss) : base(200, 200, false) { SetOrigin(width / 2, height / 2); _boss = boss; scale = 3; }