void OnTriggerEnter(Collider other) { switch (other.gameObject.tag) { case "Enemy": damageAnim.SetBool("damage", true); playerData.Damage(1); allUI.UiUpdate("ComboReset", 0); break; } }
public void EnemyDamage(string bullet) { switch (bullet) { case "NormalBullet": SoundPlayer.Instance.PlaySoundEffect("Bomb", 0.7f); EffectFactory.Instance.Create("bom", transform.position, transform.rotation); allUI.UiUpdate("ComboUp", 0); allUI.UiUpdate("ScoreUp", 100); allUI.UiUpdate("DeathBlowGaugeUp", 0); enemyHP--; break; case "SpecialArts": SoundPlayer.Instance.PlaySoundEffect("Bomb", 0.7f); EffectFactory.Instance.Create("bom", transform.position, transform.rotation); allUI.UiUpdate("ComboUp", 0); allUI.UiUpdate("ScoreUp", 100); allUI.UiUpdate("DeathBlowGaugeUp", 0); enemyHP--; break; default: Debug.LogError("bullet指定ミス"); break; } if (enemyHP <= 0) { Destroy(gameObject); } }
/***呼び出せばPlayer2Dの破壊され復活までの処理が実行される***/ public IEnumerator Resurrection() { SoundPlayer.Instance.PlaySoundEffect("Bomb", 1.0f); EffectFactory.Instance.Create("bom", transform.position, transform.rotation); GetComponent <BoxCollider>().enabled = false; allUI.UiUpdate("Lifes2D", 0); allUI.UiUpdate("ComboReset", 0); isDead = true; zikki2D.SetActive(false); while (playerData2D.resurrectionTime > 0) { playerData2D.resurrectionTime -= 1 * Time.deltaTime; yield return(null); } isDead = false; zikki2D.SetActive(true); playerData2D.resurrectionTime = 3.0f; yield return(new WaitForSeconds(2.0f)); GetComponent <BoxCollider>().enabled = true; }
/// <summary> /// ダメージ処理 /// </summary> /// <param name="bullet">弾の種類</param> /// <param name="player">攻撃しているプレイヤー</param> public void BossDamage(string bullet, string player) { switch (bullet) { case "NormalBullet": bossHp -= 1; EffectFactory.Instance.Create("hit", transform.position + new Vector3(Random.Range(-30, 30), Random.Range(-30, 30), Random.Range(-30, 30)), transform.rotation); allUi.UiUpdate("ScoreUp", 100); allUi.UiUpdate("DeathBlowGaugeUp", 0); break; case "SpecialArts": bossHp -= 100; EffectFactory.Instance.Create("hit", transform.position + new Vector3(Random.Range(-30, 30), Random.Range(-30, 30), Random.Range(-30, 30)), transform.rotation); allUi.UiUpdate("ScoreUp", 10000); allUi.UiUpdate("DeathBlowGaugeUp", 0); break; default: Debug.LogError("bullet指定ミス"); break; } switch (player) { case "2D": bossHate++; break; case "3D": bossHate--; break; default: Debug.LogError("player指定ミス"); break; } if (bossHp == 1000) { StartCoroutine(SmokeEffect()); } if (bossHate >= 10) { bossAttackTarget = TARGET2D; bossHate = 0; } if (bossHate <= -10) { bossAttackTarget = TARGET3D; bossHate = 0; } if (bossHp <= 0) { SoundPlayer.Instance.PlaySoundEffect("Bomb", 1.0f); EffectFactory.Instance.Create("bom", transform.position, transform.rotation); Destroy(gameObject); } }