public MoveResult MoveTo(Hex hex, bool forced) { if (inFlight) return MoveResult.AlreadyInFlight; if (AP <= 0) return MoveResult.NotEnoughActionPoints; if (hex.HasFigure && Owner == hex.Content.Owner) return MoveResult.BadDestination; this.forced = forced; currPath = GetPath(hex); if (currPath.Useful) { if (currPath.TotalCost > AP) return MoveResult.NotEnoughActionPoints; } else return MoveResult.Impassable; ExecuteMove(); return MoveResult.Ok; }
private bool MoveToPreviusHex() { currPath = GetPath(previousHex); if (currPath.Useful && currPath.Count == 1) { ExecuteMove(); return true; } else return false; }
private void MoveToNearestEmptyHex() { currPath = GetPath( passibilityCondition: (hex) => { if (hex.Content.Owner.IsEnemy(Owner)) return PassibilityType.AbsoluteObstacle; else return PassibilityType.Ok; }, targetCondition: (hex) => { return !hex.HasFigure; }); if (currPath.Useful) ExecuteMove(); else { Debug.Log("oops!"); Destroy(); } }