public void Say(string name, float life = 2.0f) { // check if there is an exist speech bubble, if so destroy it SpeechBubbleScript existing = GetComponentInChildren <SpeechBubbleScript> (); if (!(existing == null)) { Destroy(existing.gameObject); } GameObject bubble = Instantiate(SpeechBubble, transform); SpeechBubbleScript bubbleScript = bubble.GetComponent <SpeechBubbleScript> (); bubbleScript.SetSortingLayer(isAlice); bubbleScript.Show(name, life); this.PositionSpeechBubble(bubbleScript); float positionY = 0.6f; if (name.Equals("queueBackup")) { positionY = 1.3f; } bubbleScript.transform.localPosition = new Vector3(1.1f, positionY, 0f); }
// Use this for initialization void Start() { player = GameObject.FindWithTag("Player"); scoreObject = GameObject.Find("ScoreObject"); navmesh = GetComponent <NavMeshAgent>(); bubblectl = bubble.GetComponent <SpeechBubbleScript>(); bubble.gameObject.SetActive(false); camscript = Camera.main.GetComponent <CameraFollowPlayer>(); pc = player.GetComponent <PlayerController>(); audio = GetComponent <AudioSource>(); sk = scoreObject.GetComponent <ScoreKeeper>(); rb = GetComponent <Rigidbody>(); simonGameco = simonGame(); lookco = lookAround(); StartCoroutine(lookco); }
void PositionSpeechBubble(SpeechBubbleScript bubbleScript) { }