|
|
@ -18,7 +18,7 @@ public class YeetController : InputBehaviour |
|
|
|
|
|
|
|
public Material trajectoryLineMaterial; |
|
|
|
|
|
|
|
public enum YeetState { Unheld, Held, Yeeting }; |
|
|
|
public enum YeetState { Unheld, Held, Preyeet, Yeeting }; |
|
|
|
public YeetState yeetState { get; private set; } = YeetState.Unheld; |
|
|
|
|
|
|
|
private GameObject _child; |
|
|
@ -31,6 +31,8 @@ public class YeetController : InputBehaviour |
|
|
|
|
|
|
|
private LineRenderer m_lineRenderer; |
|
|
|
|
|
|
|
private Vector3 preyeetPosition; |
|
|
|
|
|
|
|
private void Awake() |
|
|
|
{ |
|
|
|
m_body = this.gameObject; |
|
|
@ -44,11 +46,17 @@ public class YeetController : InputBehaviour |
|
|
|
|
|
|
|
yeetState = YeetState.Held; |
|
|
|
|
|
|
|
m_YeetAnimator.SetBool("Carry", true); |
|
|
|
m_YeetAnimator.SetBool("Yeet", true); |
|
|
|
} |
|
|
|
|
|
|
|
public void Preyeet() |
|
|
|
{ |
|
|
|
preyeetPosition = parent.transform.position; |
|
|
|
m_lineRenderer = gameObject.AddComponent<LineRenderer>(); |
|
|
|
m_lineRenderer.material = trajectoryLineMaterial; |
|
|
|
|
|
|
|
m_YeetAnimator.SetBool("Carry", true); |
|
|
|
m_YeetAnimator.SetBool("Yeet", true); |
|
|
|
yeetState = YeetState.Preyeet; |
|
|
|
} |
|
|
|
|
|
|
|
public void Yeet() |
|
|
@ -86,11 +94,13 @@ public class YeetController : InputBehaviour |
|
|
|
yeetState = YeetState.Unheld; |
|
|
|
} |
|
|
|
break; |
|
|
|
case YeetState.Held: |
|
|
|
// draw yeet lines
|
|
|
|
case YeetState.Preyeet: |
|
|
|
//TODO: Stop player
|
|
|
|
parent.transform.position = preyeetPosition; |
|
|
|
|
|
|
|
_child.transform.position = handCarryingPosition.transform.position; |
|
|
|
if(m_velocityWindup < yeetVelocity) |
|
|
|
|
|
|
|
if (m_velocityWindup < yeetVelocity) |
|
|
|
{ |
|
|
|
m_velocityWindup += windupSpeed; |
|
|
|
} |
|
|
@ -111,6 +121,12 @@ public class YeetController : InputBehaviour |
|
|
|
m_lineRenderer.SetPosition(i, trajectoryPoint); |
|
|
|
} |
|
|
|
break; |
|
|
|
case YeetState.Held: |
|
|
|
//TODO: slow player
|
|
|
|
|
|
|
|
// Stop child from wriggling
|
|
|
|
_child.transform.position = handCarryingPosition.transform.position; |
|
|
|
break; |
|
|
|
case YeetState.Unheld: |
|
|
|
_child = null; |
|
|
|
break; |
|
|
@ -143,9 +159,12 @@ public class YeetController : InputBehaviour |
|
|
|
Hold(m_child); |
|
|
|
// Grab nearest baby
|
|
|
|
break; |
|
|
|
case YeetController.YeetState.Held: |
|
|
|
case YeetState.Preyeet: |
|
|
|
Yeet(); |
|
|
|
break; |
|
|
|
case YeetController.YeetState.Held: |
|
|
|
// Yeet baby
|
|
|
|
Preyeet(); |
|
|
|
break; |
|
|
|
case YeetController.YeetState.Yeeting: |
|
|
|
// Cooldown?
|
|
|
|