|
@ -9,6 +9,9 @@ public class YeetController : InputBehaviour |
|
|
public GameObject handCarryingPosition; |
|
|
public GameObject handCarryingPosition; |
|
|
public GameObject parent { get; set; } |
|
|
public GameObject parent { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public AudioClip[] yeetClips; |
|
|
|
|
|
public AudioClip[] childClips; |
|
|
|
|
|
|
|
|
public float yeetVelocity = 5f; |
|
|
public float yeetVelocity = 5f; |
|
|
public float yeetDuration = 2f; |
|
|
public float yeetDuration = 2f; |
|
|
public float windupSpeed = 0.01f; |
|
|
public float windupSpeed = 0.01f; |
|
@ -30,16 +33,21 @@ public class YeetController : InputBehaviour |
|
|
private float m_velocityWindup; |
|
|
private float m_velocityWindup; |
|
|
|
|
|
|
|
|
private LineRenderer m_lineRenderer; |
|
|
private LineRenderer m_lineRenderer; |
|
|
|
|
|
private AudioSource m_audioSource; |
|
|
|
|
|
|
|
|
private Vector3 preyeetPosition; |
|
|
private Vector3 preyeetPosition; |
|
|
|
|
|
|
|
|
private void Awake() |
|
|
private void Awake() |
|
|
{ |
|
|
{ |
|
|
m_body = this.gameObject; |
|
|
m_body = this.gameObject; |
|
|
|
|
|
m_audioSource = gameObject.AddComponent<AudioSource>(); |
|
|
|
|
|
m_audioSource.spatialBlend = 0f; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void Hold(GameObject child) |
|
|
public void Hold(GameObject child) |
|
|
{ |
|
|
{ |
|
|
|
|
|
m_audioSource.clip = childClips[Random.Range(0,childClips.Length)]; |
|
|
|
|
|
|
|
|
_child = child; |
|
|
_child = child; |
|
|
_child.transform.parent = parent.transform; |
|
|
_child.transform.parent = parent.transform; |
|
|
_child.GetComponent<YeetHandle>().held = true; |
|
|
_child.GetComponent<YeetHandle>().held = true; |
|
@ -49,6 +57,8 @@ public class YeetController : InputBehaviour |
|
|
|
|
|
|
|
|
m_YeetAnimator.SetBool("Carry", true); |
|
|
m_YeetAnimator.SetBool("Carry", true); |
|
|
m_YeetAnimator.SetBool("Yeet", true); |
|
|
m_YeetAnimator.SetBool("Yeet", true); |
|
|
|
|
|
|
|
|
|
|
|
m_audioSource.Play(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void Preyeet() |
|
|
public void Preyeet() |
|
@ -58,10 +68,13 @@ public class YeetController : InputBehaviour |
|
|
m_lineRenderer.material = trajectoryLineMaterial; |
|
|
m_lineRenderer.material = trajectoryLineMaterial; |
|
|
|
|
|
|
|
|
yeetState = YeetState.Preyeet; |
|
|
yeetState = YeetState.Preyeet; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void Yeet() |
|
|
public void Yeet() |
|
|
{ |
|
|
{ |
|
|
|
|
|
m_audioSource.clip = yeetClips[Random.Range(0,yeetClips.Length)]; |
|
|
|
|
|
|
|
|
m_YeetAnimator.SetBool("Yeet", false); |
|
|
m_YeetAnimator.SetBool("Yeet", false); |
|
|
m_YeetAnimator.SetBool("Carry", false); |
|
|
m_YeetAnimator.SetBool("Carry", false); |
|
|
|
|
|
|
|
@ -75,6 +88,7 @@ public class YeetController : InputBehaviour |
|
|
m_velocityWindup = 0; |
|
|
m_velocityWindup = 0; |
|
|
|
|
|
|
|
|
Destroy(m_lineRenderer); |
|
|
Destroy(m_lineRenderer); |
|
|
|
|
|
m_audioSource.Play(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void Start() |
|
|
void Start() |
|
|