IEnumerator FallThroughtInvincibility() { damageable.EnableInvulnerability(true); yield return(new WaitForSeconds(0.5f)); damageable.DisableInvulnerability(); }
public void OnHurt(Damager damager, Damageable damageable) { //if the player don't have control, we shouldn't be able to be hurt as this wouldn't be fair if (!PlayerInput.Instance.HaveControl) { return; } UpdateFacing(damageable.GetDamageDirection().x > 0f); damageable.EnableInvulnerability(); m_Animator.SetTrigger(m_HashHurtPara); //we only force respawn if helath > 0, otherwise both forceRespawn & Death trigger are set in the animator, messing with each other. if (damageable.CurrentHealth > 0 && damager.forceRespawn) { m_Animator.SetTrigger(m_HashForcedRespawnPara); } m_Animator.SetBool(m_HashGroundedPara, false); hurtAudioPlayer.PlayRandomSound(); //if the health is < 0, mean die callback will take care of respawn if (damager.forceRespawn && damageable.CurrentHealth > 0) { StartCoroutine(DieRespawnCoroutine(false, true)); } }
//Si es herido public void OnHurt(Damager damager, Damageable damageable) { //if the player don't have control, we shouldn't be able to be hurt as this wouldn't be fair if (!PlayerInput.Instance.HaveControl) { return; } //Actualice la cara segun la direccion del daño obtenido UpdateFacing(damageable.GetDamageDirection().x > 0f); //si es mayor a cero lanzo el ataque hacia la derecha y me impacto en la izquerda damageable.EnableInvulnerability(); //activa invulnerabilidad //Trigger de daño recibido al animador m_Animator.SetTrigger(m_HashHurtPara); //Llama a HurtSMB que activa el flickering //solo forzamos la reaparición si helath > 0, de lo contrario, los activadores forceRespawn y Death se establecen en el animador, jugando entre sí. //we only force respawn if helath > 0, otherwise both forceRespawn & Death trigger are set in the animator, messing with each other. if (damageable.CurrentHealth > 0 && damager.forceRespawn) { m_Animator.SetTrigger(m_HashForcedRespawnPara); } //piso falso m_Animator.SetBool(m_HashGroundedPara, false); hurtAudioPlayer.PlayRandomSound(); // si la salud es < 0, significa muerte la devolución de llamada tomara cuidado de reaparecer //if the health is < 0, mean die callback will take care of respawn if (damager.forceRespawn && damageable.CurrentHealth > 0) { StartCoroutine(DieRespawnCoroutine(false, true)); } }
public void OnHurt(Damager damager, Damageable damageable) { //if the player don't have control, we shouldn't be able to be hurt as this wouldn't be fair if (!PlayerInput.Instance.HaveControl) { return; } damageable.EnableInvulnerability(); //if the health is < 0, mean die callback will take care of respawn if (damager.forceRespawn && damageable.CurrentHealth > 0) { GameController.isGameOver = true; } }
public void EnableInvulnerability() { damageable.EnableInvulnerability(); }