void TweenCell() { GameObject cell; if (NPCTracker.AccusedCorrectly()) { cell = theirCell; } else { cell = yourCell; } cell.gameObject.SetActive(true); tweener = cell.GetComponent <Image>().DOFade(0, 1).SetEase(Ease.InCirc).From(); tweener.OnComplete(() => { tweener = null; if (NPCTracker.AccusedCorrectly()) { winSound.gameObject.SetActive(true); } else { loseSound.gameObject.SetActive(true); hahaBubble.gameObject.SetActive(NPCTracker.Culprit != NPCTracker.ID.Cat); catHahaBubble.gameObject.SetActive(NPCTracker.Culprit == NPCTracker.ID.Cat); } }); if (!NPCTracker.AccusedCorrectly()) { culprit.gameObject.SetActive(true); culprit.DOFade(0, 1).From().SetEase(Ease.InCirc); npc.DOFade(0, 1).SetEase(Ease.InCirc); } }
void AccuseCurrent() { Animator animator = GetComponent <Animator>(); animator.SetBool("Grounded", true); animator.SetBool("Moving", false); speechBubble.OnAccusationMade(); NPCTracker.Accused = current.ID; NPCTracker.AccusedCorrectly(); current.BecomeAccused(transform.position); accusing = true; StartCoroutine(EndGame()); }
void Update() { if (tweener != null) { return; } timer += Time.deltaTime; if ((timer >= 2) || Input.GetButtonDown("Jump")) { timer = 0; state++; if (state == 1) { bubble.gameObject.SetActive(false); catBubble.gameObject.SetActive(false); TweenCell(); } if (state == 2) { if (NPCTracker.AccusedCorrectly()) { winCard.SetActive(true); } else { loseCard.SetActive(true); } } if (state == 3) { finCard.SetActive(true); } if (state == 4) { creditsCard.SetActive(true); } if (state == 5) { UnityEngine.SceneManagement.SceneManager.LoadScene(titleScene); } } }