using Preparation.Interface; using Preparation.Utility; using System.Threading; namespace GameClass.GameObj { public abstract class Moveable : GameObj, IMoveable { protected readonly object actionLock = new(); public object ActionLock => actionLock; //player.actionLock>其他.actionLock private readonly ReaderWriterLockSlim moveReaderWriterLock = new(); public ReaderWriterLockSlim MoveReaderWriterLock => moveReaderWriterLock; //规定moveReaderWriterLock /// 移动速度 /// public long MoveSpeed { get => Interlocked.Read(ref moveSpeed); set => Interlocked.Exchange(ref moveSpeed, value); } /// /// 原初移动速度 /// public int OrgMoveSpeed { get; protected set; } /* /// /// 复活时数据重置 /// public virtual void Reset(PlaceType place) { lock (gameObjLock) { this.FacingDirection = new XY(1, 0); isMoving = false; CanMove = false; IsRemoved = true; this.Position = birthPos; this.Place= place; } }*/ public Moveable(XY initPos, int initRadius, GameObjType initType) : base(initPos, initRadius, initType) { } } }