public static void PickupAllDroppedTargets() { FlashLight flashLight = Flashlight.Get(); if (flashLight == null) { return; } Transform flashLightTransform = flashLight.transform; for (int i = targetDisks.Count - 1; i >= 0; i--) { GameObject gameObject = targetDisks[i]; if (gameObject != null) { if (gameObject.transform.parent == flashLightTransform) { continue; } else { gameObject.transform.SetParent(null); UnityEngine.Object.Destroy(gameObject); } } targetDisks.RemoveAt(i); } }
public static CreatureBoardAsset GetTargetedCreature() { Log.Debug($"StartTargeting - InteractiveTargetingMode = {InteractiveTargetingMode}"); FlashLight flashLight = Flashlight.Get(); if (flashLight != null) { if (InteractiveTargetingMode == InteractiveTargetingMode.Creatures) { return(AddTargetToNearestCreature()); } else if (InteractiveTargetingMode == InteractiveTargetingMode.CreatureSelect) { CreatureBoardAsset nearestCreature = GetNearestCreature(); Log.Debug($"nearestCreature: {nearestCreature}"); Off(); InteractiveTargetingMode = InteractiveTargetingMode.None; return(nearestCreature); } else { DropTargetAtFlashlight(); Off(); InteractiveTargetingMode = InteractiveTargetingMode.None; } } return(null); }
public static void SelectCreature(int diameter = 0) { PrepareForSelection(); FlashLight flashlight = Flashlight.Get(); if (flashlight == null) { Log.Error($"flashlight is null!"); return; } AddSelectionIndicator(flashlight); }
public static VectorDto GetTargetedPoint() { FlashLight flashLight = Flashlight.Get(); if (flashLight != null) { if (TargetingVolume != null) { MoveTargetingPrefabToWorld(flashLight); } Vector3 position = flashLight.transform.position; VectorDto result = new VectorDto(position.x, position.y, position.z); Off(); InteractiveTargetingMode = InteractiveTargetingMode.None; return(result); } return(null); }
public static FlashLight StartTargeting(string id, int rangeInFeet) { targetAnchorId = null; RemoveTargetingUI(); PrepareForSelection(); FlashLight flashlight = Flashlight.Get(); if (flashlight != null) { activeTargetDisk = AddTargetDisk(flashlight.gameObject.transform); } InitializeTargeting(); if (rangeInFeet > 0) { targetAnchorId = id; targetAnchorRange = rangeInFeet; } return(flashlight); }
// TODO: Refactor this into multiple dedicated methods with the best names ever!!! public static void On(int diameter = 0, string creatureId = null) { PrepareForSelection(); FlashLight flashlight = Flashlight.Get(); if (flashlight == null) { Log.Error($"flashlight is null!"); return; } LockTo(creatureId); GameObject targetDisk = AddTargetDisk(flashlight.gameObject.transform); //if (!string.IsNullOrWhiteSpace(creatureId)) activeTargetDisk = targetDisk; InitializeTargeting(); if (diameter > 0) { AddTargetingSphere(flashlight, diameter); } }
private static void DropTargetAtFlashlight() { Vector3 targetPosition = Flashlight.GetPosition(); AddTarget(targetPosition, Flashlight.Get().transform, 1); }