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