public void StartMovementPreview(List <float> distances, List <Vector3> trajectory, CompetenceRecall currentRecallComp, int completelyUsedActionPoints, bool reachMax) { hitByDiscTrajectories = new Dictionary <DiscScript, Dictionary <GameObject, EnemyBase> >(); movementGhostPreview.GetRenderer.material = baseGhostMaterial; Vector3 startPosition = trajectory[0]; Vector3 targetPosition = trajectory[trajectory.Count - 1]; #region Circles if (showMovementCircles) { int newNumber = distances.Count; if (newNumber > movementCirclePreviews.Count) { for (int i = movementCirclePreviews.Count; i < newNumber; i++) { MovementCirclePreview newMovementCirclePreview = Instantiate(movementCirclePreviewPrefab, movementPreviewsParent); newMovementCirclePreview.ShowPreview(); movementCirclePreviews.Add(newMovementCirclePreview); } } Vector3 circlePos = new Vector3(startPosition.x, 0.01f, startPosition.z); for (int i = 0; i < newNumber; i++) { movementCirclePreviews[i].ShowPreview(); movementCirclePreviews[i].ChangeRadius(distances[i]); movementCirclePreviews[i].transform.position = circlePos; } for (int i = newNumber; i < movementCirclePreviews.Count; i++) { movementCirclePreviews[i].HidePreview(); } } #endregion currentMovementDistances = distances; movementLinePreview.ShowPreview(); movementLinePreview.UpdateLine(trajectory, currentMovementDistances, completelyUsedActionPoints, reachMax); movementGhostPreview.ShowPreview(); movementGhostPreview.transform.position = trajectory[trajectory.Count - 1]; Dictionary <DiscScript, DiscTrajectoryParameters> discsInNewPositionRangeParameters = DiscListingFactory.GetDiscInRangeTrajectory(targetPosition, currentRecallComp); StartRecallPreview(discsInNewPositionRangeParameters, targetPosition); justStartedMovementPreview = true; UpdateMovementPreview(trajectory, currentRecallComp, completelyUsedActionPoints, reachMax); foreach (EnemyBase enemy in EnemiesManager.Instance.GetAllInGameEnemiesOrdered) { enemy.DisplayAndActualisePreviewAttack(movementGhostPreview.transform); } }
public void StartTeleportationPreview(Vector3 startPos, Vector3 targetPos, bool canTeleport, CompetenceRecall currentRecallComp) { hitByDiscTrajectories = new Dictionary <DiscScript, Dictionary <GameObject, EnemyBase> >(); movementGhostPreview.GetRenderer.material = canTeleport ? baseGhostMaterial : cantMoveThereMaterial; discEffectZonePreview.gameObject.SetActive(true); discEffectZonePreview.transform.localScale = Vector3.one * DiscManager.Instance.recallRange; discEffectZonePreview.transform.position = startPos + Vector3.up * 0.01f; movementGhostPreview.gameObject.SetActive(true); movementGhostPreview.transform.position = targetPos; Dictionary <DiscScript, DiscTrajectoryParameters> discsInNewPositionRangeParameters = DiscListingFactory.GetDiscInRangeTrajectory(targetPos, currentRecallComp); StartRecallPreview(discsInNewPositionRangeParameters, targetPos); foreach (EnemyBase enemy in EnemiesManager.Instance.GetAllInGameEnemiesOrdered) { enemy.DisplayAndActualisePreviewAttack(movementGhostPreview.transform); } }
public void UpdateTeleportationPreview(Vector3 position, bool canTeleport, CompetenceRecall currentRecallComp) { movementGhostPreview.GetRenderer.material = canTeleport ? baseGhostMaterial : cantMoveThereMaterial; movementGhostPreview.transform.position = position; Dictionary <DiscScript, DiscTrajectoryParameters> discsInNewPositionRangeParameters = DiscListingFactory.GetDiscInRangeTrajectory(position, currentRecallComp); UpdateRecallPreview(discsInNewPositionRangeParameters, position); }
public void UpdateMovementPreview(List <Vector3> trajectory, CompetenceRecall currentRecallComp, int completelyUsedActionPoints, bool reachMax) { Vector3 startPosition = trajectory[0]; Vector3 targetPosition = trajectory[trajectory.Count - 1]; movementLinePreview.UpdateLine(trajectory, currentMovementDistances, completelyUsedActionPoints, reachMax); movementGhostPreview.transform.position = targetPosition; if (!justStartedMovementPreview) { Dictionary <DiscScript, DiscTrajectoryParameters> discsInNewPositionRangeParameters = DiscListingFactory.GetDiscInRangeTrajectory(targetPosition, currentRecallComp); UpdateRecallPreview(discsInNewPositionRangeParameters, targetPosition); } else { justStartedMovementPreview = false; } }