Example #1
0
    // Update is called once per frame
    void Update()
    {
        // ハートの数が一定数超えない場合returnする
        HeartEffectGen heart = GameObject.Find("HeartEffectGenerator").GetComponent <HeartEffectGen>();

        if (heart.GetHeartCount() < heart.GetMaxHeartCount())
        {
            return;
        }


        float step = speed * Time.deltaTime;    // 回転する速さ(speedの値を変える)

        // maxActionCountまでフリフリしたら
        if (actionCount > maxActionCount)
        {
            // 元の位置に戻す
            this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.Euler(0.0f, 0.0f, 0.0f), step);
            if (this.transform.rotation.z * Mathf.Rad2Deg > -0.25f)
            {
                // 全ての値を戻す
                bAction     = false;
                bHurihuri   = false;
                actionCount = 0;
                heart.SetHeartCount(0);
                this.transform.rotation = Quaternion.Euler(new Vector3(0.0f, 0.0f, 0.0f));
            }
        }
        else
        {
            bAction = true;
            if (!bHurihuri)   // 左にフリフリ
            {
                this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.Euler(0.0f, 0.0f, 5.0f), step);
                if (this.transform.rotation.z * Mathf.Rad2Deg > 2.4f)
                {
                    bHurihuri = true;
                    actionCount++;
                }
            }
            else   // 右にフリフリ
            {
                this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.Euler(0.0f, 0.0f, -5.0f), step);
                if (this.transform.rotation.z * Mathf.Rad2Deg < -2.4f)
                {
                    bHurihuri = false;
                    actionCount++;
                }
            }
        }
    }
Example #2
0
    private void Update()
    {
        switch (nowState)
        {
        case State.None:
            break;

        case State.Loading:
            if (m_rotateOnLoading)
            {
                transform.Rotate(0f, 0f, 30f * Time.deltaTime, Space.Self);
            }
            break;

        case State.Ready:
            break;

        case State.Playing:
            if (m_rawImage == null || m_gifTextureList == null || m_gifTextureList.Count <= 0)
            {
                return;
            }
            if (m_delayTime > Time.time)
            {
                return;
            }
            // Change texture
            m_gifTextureIndex++;
            if (m_gifTextureIndex >= m_gifTextureList.Count)
            {
                UniGifImage onePicture = GameObject.Find("RawImage").GetComponent <UniGifImage>();
                if (onePicture.m_loadOnStartUrl == "sister.gif")
                {
                    loopCount = 2;
                }
                else
                {
                    loopCount = 5;
                }
                m_gifTextureIndex = 0;

                if (loopCount > 0)
                {
                    m_nowLoopCount++;
                    if (m_nowLoopCount >= loopCount)
                    {
                        // ハートの数が一定数超えない場合returnする
                        HeartEffectGen heart = GameObject.Find("HeartEffectGenerator").GetComponent <HeartEffectGen>();
                        heart.SetHeartCount(0);
                        // GifCtlをもらう
                        GifCtl gifCtl = GameObject.Find("GifControl").GetComponent <GifCtl>();
                        gifCtl.SetGifPlaying(false);
                        loopCount = 0;
                        Stop();
                        return;
                    }
                }
            }
            m_rawImage.texture = m_gifTextureList[m_gifTextureIndex].m_texture2d;
            m_delayTime        = Time.time + m_gifTextureList[m_gifTextureIndex].m_delaySec;
            break;

        case State.Pause:
            break;

        default:
            break;
        }
    }