KaiClavier

STMJumper.cs

Aug 29th, 2019
420
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Copyright (c) 2019 Kai Clavier [kaiclavier.com] Do Not Distribute
  2. using UnityEngine;
  3. using System.Collections;
  4. using UnityEngine.Events;
  5. using Fleece;
  6.  
  7. [ExecuteInEditMode] //this is needed for OnValidate to work currently
  8. public class STMJumper : MonoBehaviour, IJumperValidateable
  9. {
  10.    
  11.     public SuperTextMesh stm;
  12.     public Jumper jumper;
  13.  
  14.     public void OnEnable()
  15.     {
  16.         if(stm == null) stm = GetComponent<SuperTextMesh>();
  17.         ValidateJumper();
  18.     }
  19.     private bool validate = false;
  20.     public void OnValidate()
  21.     {
  22.         validate = true;
  23.     }
  24.     public void Update()
  25.     {
  26.         if(!Application.isPlaying && validate)
  27.         {
  28.             validate = false;
  29.             ValidateJumper();
  30.         }
  31.     }
  32.     public void ValidateJumper(){
  33.         if(jumper != null && jumper.passage != null && stm != null){
  34.             stm.text = jumper.passage.parsedText;
  35.         }
  36.     }
  37.    
  38. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×