public void TakeDamage(int damage) { if (invinsibilityTimer == 0f && myPlayerAnimationmanager.CheckNotVictoryPosing())//Only take damage if timer is off { currentLife = Mathf.Clamp(0, currentLife - damage, maxLife); UpdateUI(); if (!IsPlayerAlive()) { StartCoroutine(KillPlayer()); } else { //Trigger damage animation myPlayerCanvasAnimationmanager.PlayAnimation(PlayerCanvasAnimation.DamageTaken, "-" + damage.ToString()); myPlayerAnimationmanager.PlayNonInterruptAnimation(PlayerAnimationState.hurt, PlayerAnimationState.idle); StartCoroutine(InvinsibilityTimer()); //Perhaps stop or knock back player or something } } }
public void GivePlayerArtifact(Artifact artifact) { myPlayerCanvasAnimationmanager.PlayAnimation(PlayerCanvasAnimation.ItemFound, artifact.GetName()); myPlayerAnimationmanager.PlayNonInterruptAnimation(PlayerAnimationState.victory, PlayerAnimationState.idle); StartCoroutine(ArtifactAnimation(artifact)); }