protected override void OnCharacterActionStart(Character actor) { transform = actor.transform; HexTile startTile = actor.currentTile; if (startTile == null) { Done(); return; } List <HexTile> path = Pathfinder.FindPath(startTile, targetTile, PathFindingMode.None); if (path == null) { Done(); return; } Vector3[] line = NeverdawnUtility.PathAlongTiles(path, 0.1f, 10); float pathLength = NeverdawnUtility.GetPathLength(line); GameController.instance.party.PullCharacter(characterToPlace, targetTile.position); action = new CharacterMoveAlongPathAction(line, 1000.0f, 1.0f, false); action.ActionStart(characterToPlace); }
protected override void OnCharacterActionStart(Character actor) { transform = actor.transform; HexTile startTile = HexTerrain.GetClosestTile(character.position); if (startTile == null) { Done(); return; } List <HexTile> path = Pathfinder.FindPath(startTile, targetTile, ignoreTarget ? PathFindingMode.ExcludeTarget : PathFindingMode.None); if (path == null) { Done(); return; } if (actor.remainingSteps == 0) { Done(); return; } if (!includeLast) { path.Remove(targetTile); } while (path.Count > actor.remainingSteps + 1) { path.RemoveAt(path.Count - 1); } targetTile = path[path.Count - 1]; actor.remainingSteps -= path.Count - 1; Vector3[] line = NeverdawnUtility.PathAlongTiles(path, 0.1f, 10); float pathLength = NeverdawnUtility.GetPathLength(line); action = new CharacterMoveAlongPathAction(line, 1000.0f, 1.0f, run); action.ActionStart(actor); }
protected override void OnCharacterActionStart(Character actor) { transform = actor.transform; NavMeshPath path = new NavMeshPath(); if (NavMesh.CalculatePath(transform.position, target, NavMesh.AllAreas, path)) { Vector3[] line = NeverdawnUtility.RelaxPath(NeverdawnUtility.RefinePath(path.corners, 0.1f), 10); float pathLength = NeverdawnUtility.GetPathLength(line); if (pathLength - stoppingDistance < walkDistance) { walkDistance = pathLength - stoppingDistance; } action = new CharacterMoveAlongPathAction(line, walkDistance, 1.0f, run); action.ActionStart(actor); } else { Done(); } }