void Update() { // Joystick controller float x = DGameSystem.joystick.Horizontal; float y = DGameSystem.joystick.Vertical; if (x == 0 && y == 0) { movement.Stand(); return; } if (Mathf.Abs(x) > Mathf.Abs(y)) { if (x > 0) { movement.state = "go_right"; } else { movement.state = "go_left"; } } else { if (y > 0) { movement.state = "go_up"; } else { movement.state = "go_down"; } } }
void Update() { if (!isLocalPlayer) { return; } // Joystick controller float x = joystick.Horizontal; float y = joystick.Vertical; if (x == 0 && y == 0) { playerMovement.Stand(); return; } if (Mathf.Abs(x) > Mathf.Abs(y)) { if (x > 0) { playerMovement.state = "go_right"; } else { playerMovement.state = "go_left"; } } else { if (y > 0) { playerMovement.state = "go_up"; } else { playerMovement.state = "go_down"; } } }
void Update() { rigid.velocity = new Vector3(joystick.Horizontal, joystick.Vertical); // Joystick controller float x = joystick.Horizontal; float y = joystick.Vertical; if (x == 0 && y == 0) { playerMovement.Stand(); return; } if (Mathf.Abs(x) > Mathf.Abs(y)) { if (x > 0) { playerMovement.state = "go_right"; } else { playerMovement.state = "go_left"; } } else { if (y > 0) { playerMovement.state = "go_up"; } else { playerMovement.state = "go_down"; } } }