added chopping and mining, added particles for trees

This commit is contained in:
TAASONI3
2024-06-22 20:22:17 +02:00
parent 7b9683bb49
commit cbd086d658
15 changed files with 22023 additions and 589 deletions

View File

@@ -27,9 +27,8 @@ namespace Assets.Scripts.InteractableObjects
public void OnInteraction(GameObject player)
{
//StartCoroutine(playParticle(player));
//StartCoroutine(playAnimation(player));
StartCoroutine(playParticle(player));
StartCoroutine(playAnimation(player));
handleInteraction(player);
}
@@ -55,30 +54,8 @@ namespace Assets.Scripts.InteractableObjects
{
if (clip != null)
{
Animator animator = player.GetComponent<Animator>();
AnimationClip[] clips = animator.runtimeAnimatorController.animationClips;
float length = 0;
foreach (AnimationClip clip in clips)
{
if (clip.name.ToLower() == "disarming")
{
length = clip.length;
break;
}
}
if (player.GetComponent<PlayerGameObject>().isArmed)
{
player.GetComponent<Animator>().Play("Disarming");
yield return new WaitForSeconds(length);
}
player.GetComponent<Animator>().Play(clip.name);
yield return new WaitForSeconds(clip.length);
if (player.GetComponent<PlayerGameObject>().isArmed)
{
player.GetComponent<Animator>().Play("Arming");
yield return new WaitForSeconds(length);
}
}
animationPlayed = true;
}