Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using AC;
- public class RSL_TurnNPCoffWhenInvisible : MonoBehaviour {
- bool showWorkings=false; //so we can verify if its working, DEBUG only
- //works but needs to be on something with a renderer i think
- void OnBecameVisible() {
- if (showWorkings)
- {
- Debug.Log ("..OnBecameVisible "+name);
- }
- if (NPCcomponent==null)
- {
- Debug.Log("OnBecameInvisible-->NPCcomponent is null cant flag it as offscreen! "+name);
- return;
- }
- //now we get the npc so we can tell it that its offscreen
- NPCcomponent.isOffScreen=false;
- }
- void OnBecameInvisible() {
- if (showWorkings)
- {
- Debug.Log ("..OnBecameInvisible "+name);
- }
- if (NPCcomponent==null)
- {
- Debug.Log("OnBecameInvisible-->NPCcomponent is null cant flag it as offscreen! "+name);
- return;
- }
- //now we get the npc so we can tell it that its offscreen
- NPCcomponent.isOffScreen=true;
- }
- NPC NPCcomponent;
- // Use this for initialization
- void Start () {
- GameObject npc = transform.parent.gameObject;
- NPCcomponent = npc.GetComponent<NPC>();
- }
- // Update is called once per frame
- void Update ()
- {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment