public void UpdateCurrentDirection(Vector2 direction) { currentDirection = direction; localDirectionType = GameplayUtils.GetDirectionTypeByVector2(direction); if (IsServer) { currentDirectionType.Value = (byte)localDirectionType; } }
public void UpdateCurrentDirection(Vector2 direction) { if (direction.magnitude > 0f) { localDirection = direction; localDirectionType = GameplayUtils.GetDirectionTypeByVector2(direction); } if (IsServer && movementSecure == MovementSecure.ServerAuthoritative) { currentDirection.Value = localDirection; currentDirectionType.Value = (byte)localDirectionType; } if (IsOwnerClient && movementSecure == MovementSecure.NotSecure) { CallNetFunction(NetFuncUpdateDirection, FunctionReceivers.Server, (sbyte)(localDirection.x * 100f), (sbyte)(localDirection.y * 100f)); } }
protected void NetFuncUpdateDirection(sbyte x, sbyte y) { currentDirection.Value = new Vector2((float)x / 100f, (float)y / 100f); currentDirectionType.Value = (byte)GameplayUtils.GetDirectionTypeByVector2(currentDirection.Value); }