示例#1
0
    private void Update()
    {
        if (Vector3.Distance(transform.position, player.transform.position) < 4)
        {
            SpeechBubbleGenerator.GenerateSpeechBubble(type, new Vector3(0, 1.7f, 0), transform, "Yay! You made it!");

            GetComponent <TestSpeech>().enabled = false;

            /*
             * every time you would like to create a speech bubble, you must call:
             * SpeechBubbleGenerator.GenerateSpeechBubble([ScriptableObjectOfWhatYouWantItToLookLike], Vector3[OffsetPosition], Transform[ThingThatIsSpeaking], "[WhatYouWantToSay");
             *
             * also, you must include: using SpeechGeneration; at the top of the script.
             *
             * Enjoy!
             */
        }
    }
 // Use this for initialization
 void Start()
 {
     speechBubble = transform.parent.Find("SpeechBubble").gameObject;
     speechBubbleScript = speechBubble.GetComponent<SpeechBubbleGenerator>();
     rbody = GetComponent<Rigidbody>();
     environment = GameObject.FindGameObjectWithTag("Environment");
     eventManager = environment.GetComponent<EventManagerScript>();
 }
 void Awake()
 {
     speechBubble = transform.Find("SpeechBubble").gameObject.GetComponent<SpeechBubbleGenerator>();
     rbody = GetComponent<Rigidbody>();
 }