Example #1
0
 public void PlayEmote(string name)
 {
     emoteBubble.sprite = emoteSprites.GetSprite(name);
     currentY           = 0f;
     emoteMask.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, currentY);
     gameObject.SetActive(true);
     currentState = EmoteState.Up;
 }
Example #2
0
    // Update is called once per frame
    void Update()
    {
        switch (currentState)
        {
        case EmoteState.Up:
            currentY = Mathf.Clamp(currentY + originalSize * emoteSpeed * Time.deltaTime, 0f, originalSize);
            emoteMask.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, currentY);
            if (currentY == originalSize)
            {
                holdTimer    = 0f;
                currentState = EmoteState.Hold;
            }
            break;

        case EmoteState.Hold:
            holdTimer += Time.deltaTime;
            if (holdTimer >= holdTimeWindow)
            {
                currentState = EmoteState.Down;
            }
            break;

        case EmoteState.Down:
            currentY = Mathf.Clamp(currentY - originalSize * emoteSpeed * Time.deltaTime, 0f, originalSize);
            emoteMask.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, currentY);
            if (currentY == 0f)
            {
                currentState = EmoteState.None;
                gameObject.SetActive(false);
            }
            break;

        case EmoteState.None:
            break;
        }
    }
 public void PlayEmote(EmoteState emote)
 {
     _animator.SetFloat(kAnimEmoteState, (float)emote);
     _animator.SetTrigger(kAnimEmote);
 }