m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
- m_IsActive: 0
+ m_IsActive: 1
--- !u!4 &4617615456759737811
Transform:
m_ObjectHideFlags: 0
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 414971659141114100}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
- m_LocalPosition: {x: 0, y: -0.36000013, z: 0}
+ m_LocalPosition: {x: -0.08000004, y: -0.36000013, z: 0}
m_LocalScale: {x: 4, y: 4, z: 1}
m_Children: []
m_Father: {fileID: 5232080199619218326}
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
- m_IsActive: 0
+ m_IsActive: 1
--- !u!4 &5036223590975315366
Transform:
m_ObjectHideFlags: 0
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5886521033835613979}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
- m_LocalPosition: {x: -0.120000005, y: -0.36000013, z: 0}
+ m_LocalPosition: {x: -0.20000005, y: -0.36000013, z: 0}
m_LocalScale: {x: 4, y: 4, z: 1}
m_Children: []
m_Father: {fileID: 5232080199619218326}
/// The single ball for the game.
/// </summary>
[SerializeField] public Ball ball;
+
+ [SerializeField] private float dribbleHeight;
+ [SerializeField] private float dribbleSpeed;
+ private Vector3 ballTarget;
[SerializeField] public SpriteRenderer[] trenchCoatSegments;
freezeMotion = false;
startTime = Time.time;
- ball.Rigidbody.AddForce(new Vector2(0f, 10f));
+ ball.Rigidbody.velocity = new Vector2(0, 5f);
}
private void Update()
UpdateUI();
}
+ private void FixedUpdate()
+ {
+ if (player.HasBall || enemy.HasBall)
+ {
+ ball.transform.position = ballTarget - new Vector3(0, Mathf.Sin(Time.time * dribbleHeight * dribbleSpeed) + 1f, 0);
+ }
+ }
+
private bool gameover;
private void UpdateUI()
{
public void Move(Vector2 handPosition)
{
if (controller.state == (isEnemy ? State.EnemyDribble : State.PlayerDribble)) // Make sure they're dribbling.
- controller.ball.transform.position = handPosition; // TODO: Make this perform a dribbling motion, otherwise it looks like they're travelling.
+ controller.ballTarget = handPosition;
}
/// <summary>