Example #1
0
    // Update is called once per frame
    void Update()
    {
        GifCtl gif = GameObject.Find("GifControl").GetComponent <GifCtl>();

        if (gif.IsGifPlaying())
        {
            HandTexture.SetActive(false);
        }
        else
        {
            HandTexture.SetActive(true);
        }

        // ハートの数が一定数超えない場合returnする
        //HeartEffectGen heart = GameObject.Find("HeartEffectGenerator").GetComponent<HeartEffectGen>();
        //if (heart.GetHeartCount() > heart.GetMaxHeartCount())
        //{
        //    HandTexture.SetActive(false);
        //}
        //else
        //{
        //    HandTexture.SetActive(true);
        //}
    }
    // Update is called once per frame
    void Update()
    {
        // 手が動いているか?
        HandCtl hand = GeneratePoint.transform.GetChild(0).GetComponent <HandCtl>();

        if (!hand.IsMovement())
        {
            // Gif再生中か?
            GifCtl gif = GameObject.Find("GifControl").GetComponent <GifCtl>();
            if (gif.IsGifPlaying())
            {
                return;
            }

            heartDelta += Time.deltaTime;    // デルタを加算
            if (heartDelta > heartSubSpan)
            {
                heartDelta = 0.0f;   // デルタをリセット

                // ハートの数を減算
                heartCount--;
                if (heartCount < 0)
                {
                    heartCount = 0;
                }
            }
        }
        else
        {
            // なでなで中か?
            if (!HandCtl.isNadeNade)
            {
                return;
            }

            // Gif再生中か?
            GifCtl gif = GameObject.Find("GifControl").GetComponent <GifCtl>();
            if (gif.IsGifPlaying())
            {
                return;
            }

            SE_delta += Time.deltaTime;    // デルタを加算
            if (SE_delta > SE_Span)
            {
                AudioSource audio = this.GetComponent <AudioSource>();
                audio.Play();

                SE_delta = 0.0f;          // デルタをリセット
            }
            heartDelta += Time.deltaTime; // デルタを加算
            if (heartDelta > heartAddSpan)
            {
                heartDelta = 0.0f;   // デルタをリセット

                // ハートの数を加算
                heartCount++;
            }
        }


        // ハートの数が一定数超えたか?
        HeartEffectGen heart = GameObject.Find("HeartEffectGenerator").GetComponent <HeartEffectGen>();

        if (heartCount == heart.GetMaxHeartCount())
        {
            // 生成
            GameObject effect = Instantiate(HeartEffect) as GameObject;
            effect.transform.position = new Vector3(0.0f, -4.5f, 0.06f);
            effect.transform.Rotate(0.0f, 0.0f, 0.0f);

            // 子オブジェクトにセットする
            effect.transform.parent = this.transform;

            heartCount++;

            return;
        }


        //delta += Time.deltaTime;    // デルタを加算
        //if (delta > span)
        //{
        //    AudioSource audio = this.GetComponent<AudioSource>();
        //    audio.Play();

        //    delta = 0.0f;   // デルタをリセット

        //    // 生成
        //    GameObject effect = Instantiate(HeartEffect) as GameObject;
        //    effect.transform.position = new Vector3(GeneratePoint.transform.GetChild(0).position.x, GeneratePoint.transform.GetChild(0).position.y, 0.06f);
        //    effect.transform.Rotate(0.0f, 0.0f, 0.0f);

        //    // 子オブジェクトにセットする
        //    effect.transform.parent = this.transform;

        //    // ハートの数を加算
        //    heartCount++;
        //}
    }
Example #3
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;
        }
    }