added chopping and mining, added particles for trees
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user