Browse Source

Child is returned to Spawner On Yeet

develop
Joshua Reason 3 years ago
parent
commit
16f9d2a90b
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      Assets/Scripts/Behaviours/YeetController.cs

+ 3
- 1
Assets/Scripts/Behaviours/YeetController.cs View File

@ -34,6 +34,7 @@ public class YeetController : InputBehaviour
private LineRenderer m_lineRenderer; private LineRenderer m_lineRenderer;
private AudioSource m_audioSource; private AudioSource m_audioSource;
private Transform m_OldChildParent;
private Vector3 preyeetPosition; private Vector3 preyeetPosition;
@ -49,6 +50,7 @@ public class YeetController : InputBehaviour
m_audioSource.clip = childClips[Random.Range(0, childClips.Length)]; m_audioSource.clip = childClips[Random.Range(0, childClips.Length)];
_child = child; _child = child;
m_OldChildParent = _child.transform.parent;
_child.transform.parent = parent.transform; _child.transform.parent = parent.transform;
_child.GetComponent<YeetHandle>().held = true; _child.GetComponent<YeetHandle>().held = true;
_child.GetComponent<YeetHandle>().lastHeld = parent; _child.GetComponent<YeetHandle>().lastHeld = parent;
@ -78,7 +80,7 @@ public class YeetController : InputBehaviour
m_YeetAnimator.SetBool("Yeet", false); m_YeetAnimator.SetBool("Yeet", false);
m_YeetAnimator.SetBool("Carry", false); m_YeetAnimator.SetBool("Carry", false);
_child.transform.parent = null;
_child.transform.parent = m_OldChildParent;
_child.transform.rotation = parent.transform.rotation; _child.transform.rotation = parent.transform.rotation;
_child.GetComponent<YeetHandle>().held = false; _child.GetComponent<YeetHandle>().held = false;

Loading…
Cancel
Save