Exemplo n.º 1
0
    void ChangingFaceSpecific(RobotEmoji _emoji)
    {
        int number = (int)RobotEmoji.MaxNum;
        int index  = _emoji - Emoji;

        if (_emoji < Emoji)
        {
            index += number;
        }
        StartCoroutine(ChangingFace(index));
    }
Exemplo n.º 2
0
    //Changing face
    IEnumerator ChangingFace(int index = 1)
    {
        flag_isChangingFace = true;
        Emoji = (RobotEmoji)((int)(Emoji + index) % (int)RobotEmoji.MaxNum);
        Vector2 offset     = m_FaceMat.GetTextureOffset("_MainTex");
        Vector2 origin     = offset;
        Vector2 new_offset = offset + new Vector2(10f + index * 0.25f, 0.0f);

        for (float t = 0.0f; t <= ChangingFaceTime; t += Time.deltaTime)
        {
            offset = Vector2.Lerp(origin, new_offset, t / ChangingFaceTime);
            m_FaceMat.SetTextureOffset("_MainTex", offset);
            yield return(null);
        }
        offset = new Vector2(new_offset.x % 1, new_offset.y % 1);
        m_FaceMat.SetTextureOffset("_MainTex", offset);
        flag_isChangingFace = false;
    }