public override void Execute(List <BasicEntity> entities) { foreach (var entity in entities) { MoveComponent move = entity.gameObject.GetComponent <MoveComponent> (); AbilityComponent ab = entity.GetComponent <AbilityComponent> (); InputComponent input = entity.GetComponent <InputComponent> (); StateComponent ap = entity.GetComponent <StateComponent> (); BlockType blockType = entity.GetComponent <BlockInfoComponent>().m_blockType; int i = AiToInput.GetAbilityCount(entity, M_LinkedType); if (i >= ab.m_temporaryAbility.Count || i != input.currentKey) { continue; } UISimple ui = GameObject.Find("UI").GetComponent <UISimple>(); VoxelBlocks map = GameObject.Find("Voxel Map").transform.GetComponent <VoxelBlocks> (); if (move.pathList == null) { move.pathList = new List <Vector3> (); move.pathList.Add(entity.GetComponent <BlockInfoComponent> ().m_logicPosition); } if (move.path == null) { move.path = FindPath.FindPathInStep(move.pathList [move.pathList.Count - 1], ap.m_actionPoint * move.SPD - move.pathList.Count + 1); } List <Vector3> a = move.path; if (blockType != BlockType.Enemy) { ui.ShowUI(a, 3); } if (input.currentPos != null) { if (a.Count == 0 && input.leftButtonDown) { SetPath(move); move.pathList = null; move.path = null; input.leftButtonDown = false; return; } foreach (var bi in a) { //判断鼠标停靠位置是否位于可移动范围之内 if (bi == input.currentPos) { List <Vector3> path = new List <Vector3> (); path.AddRange(move.pathList); List <Vector3> newPath = FindPath.GetPath(move.pathList [move.pathList.Count - 1], input.currentPos); if (newPath != null) { path.AddRange(newPath); } //调用UI显示路径 if (blockType != BlockType.Enemy) { ui.ShowUI(path, 2); } if (input.midButtonDown) { move.pathList = path; move.path = null; } if (input.rightButtonDown) { move.pathList.Clear(); move.path = null; } if (input.leftButtonDown && ap.m_actionPoint != 0) { move.pathList = path; SetPath(move); move.GetComponent <StateComponent>().AnimationStart(); move.pathList = null; move.path = null; input.leftButtonDown = false; return; } } } } } }