void OnTriggerEnter(Collider other) { if (other.tag == "Player_Hitbox") { hurt_sound.Play(); player_damage = other.gameObject.GetComponent <HP_income>(); hp = hp - player_damage.HP_cal_Point; this_mat.material = hurt_mat; Invoke("normal_mat", 0.1f); } if (other.tag == "GameOver") { hp = 0; this_mat.material = hurt_mat; Invoke("normal_mat", 0.1f); } }
void OnTriggerEnter(Collider other) { if (other.tag == "Player_Hitbox") { if (IsWeak == false) { Impact_sfx.Play(); } if (IsWeak == true) { player_damage = other.gameObject.GetComponent <HP_income>(); Puffer_HP = Puffer_HP - player_damage.HP_cal_Point; Hurt_sfx.Play(); GotHit = true; this_mat.material = hurt_mat; puff_event.new_cooldown = puff_event.new_cooldown - 0.5f; Puffer_HP = Puffer_HP - player_damage.HP_cal_Point; default_mat.color = default_mat.color - new Color(0.25f, 0.5f, 0.5f); print(default_mat.color); Invoke("normal_mat", 0.1f); } } }
void OnTriggerEnter(Collider other) { if (Squid_death != true) { if (other.tag == "Player_Hitbox") { Hurt_Dmg = other.gameObject.GetComponent <HP_income>(); Squid_Hp = Squid_Hp - Hurt_Dmg.HP_cal_Point; this_mat.material = hurt_material; Squid_Death_sound.Play(); Invoke("normal_mat", 0.1f); } else if (other.tag == "GameOver") { Squid_Hp = 0; } } else { rb.constraints = RigidbodyConstraints.FreezeRotation; rb.constraints = RigidbodyConstraints.FreezePosition; } }
void OnTriggerEnter(Collider other) { if (WinStat == null) { if (other.tag == "Enemy") { Income_Point = other.gameObject.GetComponent <HP_income>(); player_hp -= Income_Point.HP_cal_Point; player_Hurt_SFX.Play(); this_mat.material = hurt_mat; Invoke("normal_mat", 0.1f); } if (other.tag == "Puffer_Hitbox") { if (IsHide.Hidding == false) { Income_Point = other.gameObject.GetComponent <HP_income>(); player_hp -= Income_Point.HP_cal_Point; player_Hurt_SFX.Play(); this_mat.material = hurt_mat; Invoke("normal_mat", 0.1f); } } if (other.tag == "Item") { Income_Point = other.gameObject.GetComponent <HP_income>(); player_hp += Income_Point.HP_cal_Point; player_score += Income_Point.Score_Point; PlayerGetItem_SFX.Play(); if (Income_Point.HP_cal_Point > 0) { this_mat.material = heal_mat; PlayerHeal_SFX.Play(); Invoke("normal_mat", 0.1f); } Destroy(other.gameObject); } if (other.tag == "GameOver") { player_hp = 0; player_Hurt_SFX.Play(); this_mat.material = hurt_mat; Invoke("normal_mat", 0.1f); } } else { if (WinStat.PlayerIsWin == false) { if (other.tag == "Enemy") { Income_Point = other.gameObject.GetComponent <HP_income>(); player_hp -= Income_Point.HP_cal_Point; player_Hurt_SFX.Play(); this_mat.material = hurt_mat; Invoke("normal_mat", 0.1f); } if (other.tag == "Item") { Income_Point = other.gameObject.GetComponent <HP_income>(); player_hp += Income_Point.HP_cal_Point; player_score += Income_Point.Score_Point; PlayerGetItem_SFX.Play(); if (Income_Point.HP_cal_Point > 0) { this_mat.material = heal_mat; PlayerHeal_SFX.Play(); Invoke("normal_mat", 0.1f); } Destroy(other.gameObject); } if (other.tag == "GameOver") { player_hp = 0; player_Hurt_SFX.Play(); this_mat.material = hurt_mat; Invoke("normal_mat", 0.1f); } } } }