/// <summary> /// Gets a random HapticLocation on the configured HardlightSuit. /// NOTE: Will remove DisabledRegions /// </summary> /// <param name="OnlyAreasWithinSet">The AreaFlags you want to randomly select from.</param> /// <param name="DisplayInEditor"></param> /// <returns>A valid HapticLocation on the body (defaults to null if none are configured or if it is configured incorrectly.</returns> public HapticLocation FindRandomLocation(AreaFlag OnlyAreasWithinSet = AreaFlag.All_Areas, bool RemoveDisabledRegions = false, bool DisplayInEditor = false) { if (RemoveDisabledRegions) { OnlyAreasWithinSet = OnlyAreasWithinSet.RemoveArea(DisabledRegions.InactiveRegions); } HapticLocation loc = Definition.GetRandomLocationWithinSet(OnlyAreasWithinSet).GetComponent <HapticLocation>(); if (loc != null) { if (!loc.LocationActive) { Debug.LogError("FindRandomLocation and GetRandomLocationWithinSet have returned a HapticLocation that is marked as inactive.\n\tThis is an expected bug but should be fixed in the future - try using DeactiveHapticLocation to turn regions off.\n"); } if (DisplayInEditor) { ColorHapticLocationInEditor(loc, Color.blue); } return(loc); } else { Debug.LogError("Failed to complete PlayerBody.FindRandomLocation(). The returned object did not have a HapticLocation component\n"); } return(null); }
public AreaFlag RemoveInactiveRegions(AreaFlag baseFlag) { return(baseFlag.RemoveArea(InactiveRegions)); }
public void EnableArea(AreaFlag AreaToAllow) { InactiveRegions.RemoveArea(AreaToAllow); }