Adventure Creator Wikia
Advertisement

The "FlashHotspots" input button can be used to flash up Hotspot highlight effects to reveal their location. However, this only works for the moment the input button is first pressed. The following script allows you to instead highlight Hotspots for the entire duration an input button is held down.

To use it:

  1. Define an input button in Unity's Input Manager named "FlashHold". This can replace the existing "FlashHotspots" input, if defined.
  2. Create a new C# script named HoldToFlash.cs, and paste the code below into it
  3. Attach the new Flash To Hold component to an empty GameObject in the scene

HoldToFlash.cs:

using UnityEngine;
using AC;

public class HoldToFlash : MonoBehaviour
{

	public string inputName = "FlashHold";

	private void Update ()
	{
		if (KickStarter.stateHandler.IsInGameplay () && KickStarter.playerInput.InputGetButton (inputName))
		{
			FlashHotspots ();
		}
		else
		{
			FlashHotspots (true);
		}
	}

	private void FlashHotspots (bool cancel = false)
	{
		foreach (Hotspot hotspot in KickStarter.stateHandler.Hotspots)
		{
			if (hotspot.highlight)
			{
				if (cancel)
				{
					hotspot.highlight.CancelFlash ();
				}
				else if (hotspot.IsOn () && hotspot.PlayerIsWithinBoundary () && hotspot != KickStarter.playerInteraction.GetActiveHotspot ())
				{
					hotspot.highlight.flashHoldTime = 1000f;
					hotspot.highlight.Flash ();
				}
			}
		}
	}

}
Advertisement