M2C_PathfindingResultHandler.cs 819 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
using ETModel;
using UnityEngine;

namespace ETHotfix
{
	[MessageHandler]
	public class M2C_PathfindingResultHandler : AMHandler<M2C_PathfindingResult>
	{
		protected override void Run(ETModel.Session session, M2C_PathfindingResult message)
		{
			Unit unit = ETModel.Game.Scene.GetComponent<UnitComponent>().Get(message.Id);
			
T
tanghai 已提交
13 14
			
			unit.GetComponent<AnimatorComponent>().SetFloatValue("Speed", 5f);
15 16
			UnitPathComponent unitPathComponent = unit.GetComponent<UnitPathComponent>();

17
			unitPathComponent.StartMove(message).Coroutine();
18 19 20 21 22 23 24 25 26 27

			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]));
			}
		}
	}
}