// Use this for initialization void Start() { zik.Stop(); left = left.GetComponent <Animator>(); mid = mid.GetComponent <Animator>(); right = right.GetComponent <Animator>(); leftLength = left.GetCurrentAnimatorStateInfo(0).length + 0.5f; midLength = mid.GetCurrentAnimatorStateInfo(0).length + 0.5f; rightLength = right.GetCurrentAnimatorStateInfo(0).length + 0.5f; endLvl = GameObject.FindWithTag("endPoint").GetComponent <EndLevelTrigger>(); StartCoroutine(Wait()); //Debug.Log(left.GetCurrentAnimatorStateInfo(0).IsName("StarLeft")); }
void Awake() { //Ensure persistence so that the endpoint is always available as the target for the AIPathfinding.cs script. endPoint = GameObject.Find("Endpoint"); playerCharacter = GameObject.Find("PlayerCharacter"); timer = GameObject.Find("LevelCanvas"); if (triggerInstance == null) { DontDestroyOnLoad(this); triggerInstance = this; } else if (triggerInstance != null) { Destroy(this.gameObject); } }
private void OnNext() { if (Index < Sentences.Count - 1) { Index++; if (Sentences[Index] == "Win") { OnEnd?.Invoke(this); OnWin?.Invoke(this); return; } else if (Sentences[Index] == "Choice" && !IsInChoice) { IsInChoice = true; Choice(); text.text = ""; return; } text.text = ""; //if (isAngry) CameraShake.Instance.ScreenShake(0.4f, 15f); StartCoroutine(DisplaySentence()); if (DialGiveDontGive == 3 && Index == 5) { ApoRa.Instance.Transition(); // HolorRa.Instance.chan } else if (DialGiveDontGive == 2 && Index == 3) { ApoRa.Instance.Transition(); // HolorRa.Instance.tra } if (isAngry) { CameraShake.Instance.ScreenShake((float)Sentences[Index].Length * typingSpeed, 15); } } else { OnEnd?.Invoke(this); if (isAngry) { EndLevelTrigger.End(); } } }