Ejemplo n.º 1
0
 public override void Dispose()
 {
     if (this.IsDisposed)
     {
         return;
     }
     base.Dispose();
     this.needTime            = 0;
     this.Target              = Vector3.zero;
     this.StartPos            = Vector3.zero;
     this.m_UnitPathComponent = null;
 }
Ejemplo n.º 2
0
        public ICommandResult Simulate(ICommandInput commandInput, Unit unit)
        {
            CommandInput_Move input_Move        = commandInput as CommandInput_Move;
            UnitPathComponent unitPathComponent = unit.GetComponent <UnitPathComponent>();

            PathfindingComponent pathfindingComponent = Game.Scene.GetComponent <PathfindingComponent>();

            unitPathComponent.ABPath = ComponentFactory.Create <ABPathWrap, Vector3, Vector3>(unit.Position, input_Move.clickPos);
            pathfindingComponent.Search(unitPathComponent.ABPath);

            CommandResult_Move result_Move = CommandGCHelper.GetCommandResult <CommandResult_Move>();

            result_Move.Path = unitPathComponent.ABPath.Result;
            // result_Move.dir = input_Move.moveDir;// 暂时就以输入的方向作为角色的方向
            return(result_Move);
        }
        protected override async ETTask Run(ETModel.Session session, M2C_PathfindingResult message)
        {
            Unit unit = ETModel.Game.Scene.GetComponent <UnitComponent>().Get(message.Id);


            unit.GetComponent <AnimatorComponent>().SetFloatValue("Speed", 5f);
            UnitPathComponent unitPathComponent = unit.GetComponent <UnitPathComponent>();

            unitPathComponent.StartMove(message).Coroutine();

            GizmosDebug.Instance.Path.Clear();
            GizmosDebug.Instance.Path.Add(new Vector3(message.X, message.Y, message.Z));
            for (int i = 0; i < message.Xs.Count; ++i)
            {
                GizmosDebug.Instance.Path.Add(new Vector3(message.Xs[i], message.Ys[i], message.Zs[i]));
            }

            await ETTask.CompletedTask;
        }
Ejemplo n.º 4
0
 public void Awake()
 {
     m_UnitPathComponent = this.Entity.GetComponent <UnitPathComponent>();
 }