// DisplayTip - Displays the tip box. void DisplayTip(TipBoxInfo info) { CancelInvoke("HideTip"); tipMessage.text = info.text; tipMessage.color = info.textColor; tipBackground.color = info.boxColor; tipBackground.gameObject.SetActive(true); Invoke("HideTip", info.duration); }
// OnTriggerEnter - Called when object enters trigger radius. void OnTriggerEnter() { shouldTeleport = true; // If entity can be seen, fade away. if (visible) { StartCoroutine("FadeOut"); } // Otherwise, do something spooky. else { Teleport(); int effect = Random.Range(0, 6); switch (effect) { case 0: AudioSource.PlayClipAtPoint((AudioClip)Resources.Load("Sounds/SpookyWind"), cam.position, settings.FXScaler); break; case 1: marble.marbody.AddForce(Random.insideUnitSphere.normalized * 2000); break; case 2: if (useJumpScare) { StartCoroutine("JumpScare"); } break; case 3: marble.ClearAllBuffs(); break; case 4: gm.timer++; break; case 5: TipBoxInfo scaryMessage = new TipBoxInfo("...I see you...", Color.white, Color.black, 3); //References.hud.tipBox.color = Color.black; Messenger <TipBoxInfo> .Broadcast("DisplayTip", scaryMessage); break; //References.hud.tipMessage.color = Color.white; //References.hud.tipMessage.text = "...I see you..."; //References.hud.tipWindow.SetActive(true); break; default: break; } } }
// Use this for initialization void Start() { info = new TipBoxInfo(tip, textColor, backColor, duration); info.text = Substitute(info.text); }