public List <Point2> GetCanMovePoint(Unit _unit) { List <Point2> standingList = CompornentUtility.FindCompornentOnScene <UnitManager>().GetStandingPoints(); List <Point2> canMovePoints = new List <Point2>(); Point2 pivot = _unit.pos; int moveRange = _unit.GetUnitStatus.moveRange; var crossPoints = StageUtility.GetCrossPoint(pivot, moveRange); foreach (var point in crossPoints) { //既にunitがいた場合continue if (standingList.Contains(point)) { continue; } //たどり着けるかチェック var pathList = pathCreater.GetPath(_unit.pos, point, _unit.GetUnitStatus.stepHeight); if (pathList == null) { continue; } //unitの設定歩数で行けるかチェック if (pathList.Count > moveRange) { continue; } canMovePoints.Add(point); } return(canMovePoints); }
public void MoveToPoint(Point2 _point) { if (isMoving) { return; } PathCreater pathCre = CompornentUtility.FindCompornentOnScene <PathCreater>(); var path = pathCre.GetPath(myUnit.pos, _point, myUnit.GetMaxUnitStatus.stepHeight); if (path != null) { myUnit.pos = _point; myUnit.StartCoroutine(MoveRoutine(path)); } }