초기커밋
This commit is contained in:
92
ServerCommon/Helper/LocationHelper.cs
Normal file
92
ServerCommon/Helper/LocationHelper.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public static class LocationHelper
|
||||
{
|
||||
public static void clear(this ChannelServerLocation location)
|
||||
{
|
||||
location.SpawnPos = Vector3.Zero;
|
||||
location.ForwardAngle = 0.0f;
|
||||
location.ServerName = string.Empty;
|
||||
location.WorldMetaId = 0;
|
||||
}
|
||||
|
||||
public static void clear(this IndunLocation location)
|
||||
{
|
||||
location.SpawnPos = Vector3.Zero;
|
||||
location.ForwardAngle = 0.0f;
|
||||
location.InstanceMetaId = 0;
|
||||
location.InstanceRoomId = string.Empty;
|
||||
}
|
||||
|
||||
public static ChannelServerLocation clone(this ChannelServerLocation location)
|
||||
{
|
||||
ChannelServerLocation clone = new();
|
||||
|
||||
clone.SpawnPos = location.SpawnPos;
|
||||
clone.ForwardAngle = location.ForwardAngle;
|
||||
clone.ServerName = location.ServerName;
|
||||
clone.WorldMetaId = location.WorldMetaId;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
public static IndunLocation clone(this IndunLocation location)
|
||||
{
|
||||
IndunLocation clone = new();
|
||||
|
||||
clone.SpawnPos = location.SpawnPos;
|
||||
clone.ForwardAngle = location.ForwardAngle;
|
||||
clone.InstanceMetaId = location.InstanceMetaId;
|
||||
clone.InstanceRoomId = location.InstanceRoomId;
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
public static void toPos(this BaseLoaction location, Pos pos)
|
||||
{
|
||||
pos.X = location.SpawnPos.X;
|
||||
pos.Y = location.SpawnPos.Y;
|
||||
pos.Z = location.SpawnPos.Z;
|
||||
pos.Angle = (int)location.ForwardAngle;
|
||||
}
|
||||
|
||||
public static void fromPos(this BaseLoaction location, Pos pos)
|
||||
{
|
||||
var newPos = new Vector3(pos.X, pos.Y, pos.Z);
|
||||
|
||||
location.SpawnPos = newPos;
|
||||
location.ForwardAngle = pos.Angle;
|
||||
}
|
||||
|
||||
public static Vector3 toVector3(this Pos pos)
|
||||
{
|
||||
Vector3 new_pos;
|
||||
|
||||
new_pos.X = pos.X;
|
||||
new_pos.Y = pos.Y;
|
||||
new_pos.Z = pos.Z;
|
||||
|
||||
return new_pos;
|
||||
}
|
||||
|
||||
public static Pos toPos(this Vector3 pos)
|
||||
{
|
||||
var new_pos = new Pos();
|
||||
|
||||
new_pos.X = pos.X;
|
||||
new_pos.Y = pos.Y;
|
||||
new_pos.Z = pos.Z;
|
||||
|
||||
return new_pos;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user