public void ShowText(TextNode tNode) { Sprite sprite = Database.instance.GetSpriteForEntity(tNode.ownerId); DoodleAnimationFile emphasisAnimation = GetMessageEmphasis(tNode.emphasis); if (tNode.ownerId == Database.PLAYER_ID) { playerOptionsScrollPane.gameObject.SetActive(false); playerMessageText.gameObject.SetActive(true); playerPanel.GetComponent <DoodleAnimator>().ChangeAnimation(emphasisAnimation); if (!playerPanel.activeSelf) { AudioManager.instance.PlaySfxForCharacter("player"); AnimatePanelIn(playerPanel, "player"); } playerPortrait.sprite = sprite; UpdateText(tNode.id, playerMessageText); } else { npcMessageText.gameObject.SetActive(true); npcPanel.GetComponent <DoodleAnimator>().ChangeAnimation(emphasisAnimation); if (!npcPanel.activeSelf) { AnimatePanelIn(npcPanel, tNode.ownerId); } if (sprite != npcPortrait.sprite) { AudioManager.instance.PlaySfxForCharacter(tNode.ownerId); } npcPortrait.sprite = sprite; UpdateText(tNode.id, npcMessageText); } }
IEnumerator PlaySequence(DoodleAnimationFile anim) { int i = 0; while (i < 1) { // Set the new animation animator.ChangeAnimation(anim); // Play the animation and wait until it's finished yield return(animator.PlayAndPauseAt()); // Advanced to the next animation i++; } if (player == 1) { animator.ChangeAnimation(slutIdleAnim); } else if (player == 2) { animator.ChangeAnimation(prudeIdleAnim); } animReady = true; if (anim == slutActionAnim || anim == prudeActionAnim) { GetComponent <Action>().doAction = false; GetComponent <Move>().stopForAction = false; } else if (anim == slutHurtAnim || anim == prudeHurtAnim || anim == slutGoodHurtAnim || anim == prudeGoodHurtAnim) { GetComponent <Hurt>().doHurt = false; GetComponent <Hurt>().goodHurt = false; GetComponent <Hurt>().hurting = false; GetComponent <Move>().stopForAction = false; } }
// Update is called once per frame void Update() { if ((lastPosition - transform.position).magnitude > 0.01) { if (currentAnim != walkAnim) { currentAnim = walkAnim; doodleGirl.ChangeAnimation(walkAnim); doodleGirl.GoToAndPlay(); } } else { if (currentAnim != standAnim) { currentAnim = standAnim; doodleGirl.ChangeAnimation(standAnim); doodleGirl.GoToAndPlay(); } } lastPosition = transform.position; }
public void ShowDetailedImage(DoodleAnimationFile doodleAnimation) { detailAnimator.ChangeAnimation(doodleAnimation); detailPanel.SetActive(true); }
//hierarchy of animations //some animations can interupt and others cannot //Play whatever animation void PlayAnim(DoodleAnimationFile toPlay) { animator.ChangeAnimation(toPlay); animator.Play(); }