/// <summary> /// Move into the given playable. /// </summary> /// <param name="next"></param> public void MoveTo(Playable next) { next.Enter(); if (currentPlayable != null) { currentPlayable.Leave(); } currentPlayable = next; // NB: only update if it has an ID assigned. if (currentPlayable.Id != "") { State.CurrentPlayableId = currentPlayable.Id; } }
void Update() { currentPlayable.PlayableUpdate(); if (Input.GetMouseButton(0) && currentTarget != null) { Playable nextPlayable = currentTarget.GetComponent <Playable>(); if (nextPlayable != null) { if (Input.GetMouseButton(0)) { nextPlayable.Enter(); currentPlayable.Leave(); currentPlayable = nextPlayable; if (currentPlayable.Id != null && currentPlayable.Id != "") { State.CurrentPlayableId = currentPlayable.Id; } } } } }
void Start() { currentPlayable = State.CurrentPlayable; currentPlayable.Enter(); FindObjectOfType <HoverController>().OnHoverUpdate += this.OnHoverUpdate; }