Created
October 2, 2020 15:29
-
-
Save Garabed96/007bacb39e9a526f2e887ae718ce3178 to your computer and use it in GitHub Desktop.
ReferenceExample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Written by Kaz Crowe */ | |
/* ReferenceExampl,e.cs */ | |
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class ReferenceExample : MonoBehaviour | |
{ | |
UltimateRadialMenu outerRadialMenu; | |
bool outerMenuSelected = false; | |
UltimateRadialMenu middleRadialMenu; | |
bool middleMenuSelected = false; | |
UltimateRadialMenu innerRadialMenu; | |
bool innerMenuSelected = false; | |
float timer = 0.0f; | |
public float interactionTime = 5.0f; | |
bool isHoveringButton = false; | |
int buttonIndex = 0; | |
private void Start () | |
{ | |
outerRadialMenu.OnRadialButtonEnter += OnRadialMenuButtonEnter; | |
outerRadialMenu.OnRadialMenuLostFocus += OnRadialMenuLostFocus; | |
middleRadialMenu.OnRadialButtonEnter += OnRadialMenuButtonEnter; | |
middleRadialMenu.OnRadialMenuLostFocus += OnRadialMenuLostFocus; | |
innerRadialMenu.OnRadialButtonEnter += OnRadialMenuButtonEnter; | |
innerRadialMenu.OnRadialMenuLostFocus += OnRadialMenuLostFocus; | |
Debug.Log("This runs at the end of the start function"); | |
} | |
void OnRadialMenuButtonEnter ( int i ) | |
{ | |
isHoveringButton = true; | |
} | |
void InnerButtonEnter ( int i ) | |
{ | |
innerMenuSelected = true; | |
buttonIndex = i; | |
} | |
void OnRadialMenuLostFocus () | |
{ | |
isHoveringButton = false; | |
} | |
private void Update () | |
{ | |
if( !isHoveringButton ) | |
return; | |
timer += Time.deltaTime; | |
if( timer >= interactionTime ) | |
{ | |
if( outerMenuSelected ) | |
{ | |
outerRadialMenu.UltimateRadialButtonList[ buttonIndex ].OnInteract(); | |
} | |
else if( middleMenuSelected ) | |
{ | |
middleRadialMenu.UltimateRadialButtonList[buttonIndex].OnInteract(); | |
} | |
else if( innerMenuSelected ) | |
{ | |
innerRadialMenu.UltimateRadialButtonList[buttonIndex].OnInteract(); | |
} | |
// This | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment