zxl
/
CTT
forked from Cal/CTT
1
0
Fork 0
CTT/Unity/Assets/HotfixView/Entity/UnitPathComponent.cs

32 lines
932 B
C#

using ET;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
namespace ET
{
public class UnitPathComponentAwakeSystem : AwakeSystem<UnitPathComponent>
{
public override void Awake(UnitPathComponent self)
{
}
}
public class UnitPathComponent : Entity
{
private MonoAnimancer animancer;
private Unit unit;
public ETCancellationToken cancellationTokenSource;
public async ETVoid StartMove(Vector2 currPos,Vector2 targetPos,float speed)
{
unit = GetParent<Unit>();
using var listComponent = ListComponent<Vector3>.Create();
listComponent.List.Add(new Vector3(currPos.x, currPos.y, PosHelper.PlayerPos_Z));
listComponent.List.Add(new Vector3(targetPos.x, targetPos.y, PosHelper.PlayerPos_Z));
await this.parent.GetComponent<MoveComponent>().MoveToAsync(listComponent.List, speed);
}
}
}