CTT/Unity/Assets/HotfixView/Entity/UnitPathComponent.cs

32 lines
932 B
C#
Raw Normal View History

2021-04-08 20:09:59 +08:00
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);
}
}
}