public IEnumerator AnimLight() { while (true) { act.SwitchState(null); yield return new WaitForSeconds(Random.Range(0.01f, 0.1f)); act.SwitchState(null); yield return new WaitForSeconds(Random.Range(0.01f, 0.1f)); act.SwitchState(null); yield return new WaitForSeconds(Random.Range(0.01f, 0.1f)); act.SwitchState(null); yield return new WaitForSeconds(Random.Range(0.01f, 0.1f)); act.SwitchState(null); yield return new WaitForSeconds(Random.Range(0.01f, 0.1f)); act.SwitchState(null); yield return new WaitForSeconds(Random.Range(0.01f, 0.1f)); act.SwitchState(null); yield return new WaitForSeconds(Random.Range(0.01f, 0.1f)); act.SwitchState(null); yield return new WaitForSeconds(Random.Range(7f, 18f)); } }
public static void ActivateHighlightedActivableObject() { if (Application.isPlaying) { try { GameObject obj = Selection.activeGameObject; Activable actObj = obj.GetComponent <Activable>(); if (actObj != null) { actObj.SwitchState(null); } } catch { Debug.Log("No object selected!"); } } else { Debug.LogError("Not in play mode."); } }