|
|
@ -18,7 +18,7 @@ namespace Game { |
|
|
|
public class Player : NetworkBehaviour { |
|
|
|
public class Player : NetworkBehaviour { |
|
|
|
|
|
|
|
|
|
|
|
public Side Side { get; set; } |
|
|
|
public Side Side { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
protected bool goingLeft, goingRight; |
|
|
|
protected bool goingLeft, goingRight; |
|
|
|
|
|
|
|
|
|
|
|
public VisualElement Panel { get; private set; } |
|
|
|
public VisualElement Panel { get; private set; } |
|
|
@ -100,6 +100,22 @@ namespace Game { |
|
|
|
transform.Rotate(transform.forward, 180); |
|
|
|
transform.Rotate(transform.forward, 180); |
|
|
|
Panel = GameUI.Singleton.PlayerPanel(Side); |
|
|
|
Panel = GameUI.Singleton.PlayerPanel(Side); |
|
|
|
UpdatePanel(); |
|
|
|
UpdatePanel(); |
|
|
|
|
|
|
|
GameUI.Singleton.buttonDown += (side, direction) => { |
|
|
|
|
|
|
|
if (!side.Equals(Side)) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
if (direction == "left") |
|
|
|
|
|
|
|
goingLeft = true; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
goingRight = true; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
GameUI.Singleton.buttonUp += (side, direction) => { |
|
|
|
|
|
|
|
if (!side.Equals(Side)) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
if (direction == "left") |
|
|
|
|
|
|
|
goingLeft = false; |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
goingRight = false; |
|
|
|
|
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void OnCollisionEnter2D(Collision2D other) { |
|
|
|
private void OnCollisionEnter2D(Collision2D other) { |
|
|
@ -115,8 +131,8 @@ namespace Game { |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
var keyboard = Keyboard.current; |
|
|
|
var keyboard = Keyboard.current; |
|
|
|
goingLeft = keyboard.aKey.isPressed; |
|
|
|
//goingLeft = keyboard.aKey.isPressed; |
|
|
|
goingRight = keyboard.dKey.isPressed; |
|
|
|
//goingRight = keyboard.dKey.isPressed; |
|
|
|
|
|
|
|
|
|
|
|
TryLinearMove(Time.fixedDeltaTime); |
|
|
|
TryLinearMove(Time.fixedDeltaTime); |
|
|
|
} |
|
|
|
} |
|
|
|