移动和旋转
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using NBC;
|
||||
using NBC.Entitas;
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
@@ -12,34 +13,34 @@ namespace NBF.Fishing2
|
||||
{
|
||||
public int ConfigId { get; set; } //配置表id
|
||||
|
||||
private float3 position; //坐标
|
||||
private Vector3 position; //坐标
|
||||
|
||||
public float3 Position
|
||||
public Vector3 Position
|
||||
{
|
||||
get => position;
|
||||
set
|
||||
{
|
||||
float3 oldPos = position;
|
||||
Vector3 oldPos = position;
|
||||
position = value;
|
||||
Scene.EventComponent.Publish(new ChangePosition() { MapUnit = this, OldPos = oldPos });
|
||||
// Scene.EventComponent.Publish(new ChangePosition() { MapUnit = this, OldPos = oldPos });
|
||||
}
|
||||
}
|
||||
|
||||
public float3 Forward
|
||||
public Vector3 Forward
|
||||
{
|
||||
get => math.mul(Rotation, math.forward());
|
||||
set => Rotation = quaternion.LookRotation(value, math.up());
|
||||
set => Rotation = Quaternion.LookRotation(value, math.up());
|
||||
}
|
||||
|
||||
private quaternion rotation;
|
||||
private Quaternion rotation;
|
||||
|
||||
public quaternion Rotation
|
||||
public Quaternion Rotation
|
||||
{
|
||||
get => rotation;
|
||||
set
|
||||
{
|
||||
rotation = value;
|
||||
Scene.EventComponent.Publish(new ChangeRotation() { MapUnit = this });
|
||||
// Scene.EventComponent.Publish(new ChangeRotation() { MapUnit = this });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +55,7 @@ namespace NBF.Fishing2
|
||||
|
||||
public void SetUnitInfo(MapUnitInfo unitInfo)
|
||||
{
|
||||
var moveComponent = GetOrAddComponent<MoveComponent>();
|
||||
GetOrAddComponent<MoveComponent>();
|
||||
GetOrAddComponent<ObjectWait>();
|
||||
var unitBasic = GetOrAddComponent<MapUnitBasic>();
|
||||
unitBasic.UpdateInfo(unitInfo);
|
||||
|
||||
Reference in New Issue
Block a user