-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Player model, smooth(ish) movement, better clienttester #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before merging this change, take a look at improving the request's code style and reusability. Please take a look at my inline comments and let me know if you have any questions or disagree with any of my findings.
NitroxClient/NitroxClient.csproj
Outdated
@@ -37,6 +37,9 @@ | |||
<Reference Include="Assembly-CSharp-firstpass"> | |||
<HintPath>C:\Program Files (x86)\Steam\steamapps\common\Subnautica\Subnautica_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath> | |||
</Reference> | |||
<Reference Include="iTween"> |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
public void UpdatePlayerPosition(String playerId, Vector3 position, Quaternion rotation) | ||
{ | ||
GameObject player = GetPlayerGameObject(playerId); | ||
player.SetActive(true); | ||
player.transform.position = position; | ||
player.transform.rotation = rotation; | ||
iTween.MoveTo(player, iTween.Hash("position", position, "easetype", iTween.EaseType.easeInOutSine, "time", 0.05f)); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
player.transform.position = position; | ||
player.transform.rotation = rotation; | ||
iTween.MoveTo(player, iTween.Hash("position", position, "easetype", iTween.EaseType.easeInOutSine, "time", 0.05f)); | ||
iTween.RotateTo(player, iTween.Hash("rotation", rotation.eulerAngles, "easetype", iTween.EaseType.easeInOutSine, "time", 0.05f)); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -36,7 +36,13 @@ public GameObject GetPlayerGameObject(String playerId) | |||
|
|||
private GameObject createOtherPlayer(String playerId) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
ClientTester/Program.cs
Outdated
switch (cmd[0]) | ||
{ | ||
case "chat": | ||
if (cmd.Count < 1) { Console.WriteLine($"\"{cmd[0]}\" does not take {cmd.Count - 1} arguments"); break; } |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -9,6 +13,8 @@ class Program | |||
{ | |||
private static readonly string DEFAULT_IP_ADDRESS = "127.0.0.1"; | |||
|
|||
private static Vector3 clientPos = new Vector3(-50f, -2f, -38f); | |||
|
|||
static void Main(string[] args) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple nitpicks and ideas. Do with it as you like, and let me know what you think about them.
|
||
public void TakeCommand(string command) | ||
{ | ||
String[] commandArray = Regex.Matches(Console.ReadLine(), @"[\""].+?[\""]|[^ ]+") |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
RegisterCommand(new HelpCommand(commands)); | ||
} | ||
|
||
public void RegisterCommand(NitroxCommand command) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
return; | ||
} | ||
|
||
if (args.Length > 4) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
{ | ||
Name = "build"; | ||
Description = "Builds an object with the builder tool."; | ||
Syntax = "build <techtype> <x> <y> <z> [xrot] [yrot] [zrot]"; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
public override void Execute(MultiplayerClient client, string[] args) | ||
{ | ||
if (args.Length < 1) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
float velX = curX - lastX; | ||
float velY = curY - lastY; | ||
client.clientPos += new Vector3(velX / 10f, 0, velY / 10f); | ||
client.PacketSender.UpdatePlayerLocation(client.clientPos, Quaternion.identity, Optional<VehicleModel>.Empty()); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
{ | ||
public PosCommand() | ||
{ | ||
Name = "drop"; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
public override void Execute(MultiplayerClient client, string[] args) | ||
{ | ||
if (args.Length < 4) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
ClientTester/Program.cs
Outdated
|
||
private static int lastX = -1; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
||
namespace NitroxClient.GameLogic | ||
{ | ||
public class MovementHelper |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Player model, smooth(ish) movement, better clienttester
Servers now work on linux
No description provided.