@@ -1,32 +0,0 @@
-using System.Collections.Generic;
-using System.Numerics;
-using Unity.Mathematics;
-
-namespace ET.Client
-{
- public static class MoveHelper
- {
- // 可以多次调用,多次调用的话会取消上一次的协程
- public static async ETTask<int> MoveToAsync(this Unit unit, float3 targetPos, ETCancellationToken cancellationToken = null)
- C2M_PathfindingResult msg = new C2M_PathfindingResult() { Position = targetPos };
- unit.ClientScene().GetComponent<SessionComponent>().Session.Send(msg);
- ObjectWait objectWait = unit.GetComponent<ObjectWait>();
- // 要取消上一次的移动协程
- objectWait.Notify(new Wait_UnitStop() { Error = WaitTypeError.Cancel });
- // 一直等到unit发送stop
- Wait_UnitStop waitUnitStop = await objectWait.Wait<Wait_UnitStop>(cancellationToken);
- return waitUnitStop.Error;
- }
- public static async ETTask MoveToAsync(this Unit unit, List<float3> path)
- float speed = unit.GetComponent<NumericComponent>().GetAsFloat(NumericType.Speed);
- MoveComponent moveComponent = unit.GetComponent<MoveComponent>();
- await moveComponent.MoveToAsync(path, speed);
-}
@@ -1,11 +0,0 @@
-fileFormatVersion: 2
-guid: 9517a733443387b49a227cfb10aa82d6
-MonoImporter:
- externalObjects: {}
- serializedVersion: 2
- defaultReferences: []
- executionOrder: 0
- icon: {instanceID: 0}
- userData:
- assetBundleName:
- assetBundleVariant:
- [ComponentOf(typeof(Unit))]
- public class XunLuoPathComponent: Entity, IAwake
- public float3[] path = new float3[] { new float3(0, 0, 0), new float3(20, 0, 0), new float3(20, 0, 20), new float3(0, 0, 20), };
- public int Index;
-guid: 9cf32cd19c3004b4a8e0651fc3047743
-namespace ET.Client
- public struct Wait_UnitStop: IWaitType
- public int Error
- get;
- set;
-guid: 520adb45ec50ad341ac0c4171753c4f8