Пример #1
0
    private void Update()
    {
        if (targetObject == null)
        {
            return;                       // ターゲットが無い場合
        }
        currentTime += Time.deltaTime;

        if (isLife)
        {
            Alive();
            return;
        }

        if (delay < currentTime && playSystem.GetHeroStopFlag())
        {
            ComparePosition();
            isLife = !isLife;
            rippleParticle.SetActive(isLife);
            touchHand.SetActive(isLife);
            touchHand.GetComponent <TapToStart>().StartThisCoroutine();
            currentTime = 0.0f;
        }

        if (!playSystem.GetHeroStopFlag() || playSystem.GetMenuPauseFlag())
        {
            isLife = false;
            rippleParticle.SetActive(isLife);
            touchHand.SetActive(isLife);
        }
    }
Пример #2
0
    /// <summary>
    /// 紙を折る。
    /// </summary>
    /// <param name="center"></param>
    /// <returns></returns>
    IEnumerator Folding(float center)
    {
        isFolding = true;

        // 音が鳴らせる
        bool soundDebug = playSystem.GetComponent <PlaySystem>().GetSoundDebug();

        if (!soundDebug)
        {
            SoundManager.Instance.Play_FoldSE();
        }
        //playSystem.Pause();
        switch (dir)
        {
        case Side.LEFT:
            while (degree >= -180)
            {
                for (int id = 0; id < vertices.Length; id++)
                {
                    if (originalVert[id].x >= center)
                    {
                        continue;
                    }

                    vertices[id].x = Mathf.Sqrt(Mathf.Pow((originalVert[id].x - center), 2) + (Mathf.Pow(originalVert[id].z, 2))) * -Mathf.Cos(degree * Mathf.Deg2Rad) + center;
                    vertices[id].z = Mathf.Sqrt(Mathf.Pow((originalVert[id].x - center), 2) + (Mathf.Pow(originalVert[id].z, 2))) * Mathf.Sin(degree * Mathf.Deg2Rad) + 0;

                    mesh.vertices = vertices;
                }
                degree -= 36;

                // ゲームがポーズされたら
                while (playSystem.GetMenuPauseFlag())
                {
                    yield return(null);
                }

                yield return(new WaitForSeconds(.1f));
            }
            break;

        case Side.RIGHT:
            while (degree <= 180)
            {
                for (int id = 0; id < vertices.Length; id++)
                {
                    if (originalVert[id].x <= center)
                    {
                        continue;
                    }

                    vertices[id].x = Mathf.Sqrt(Mathf.Pow((originalVert[id].x - center), 2) + (Mathf.Pow(originalVert[id].z, 2))) * Mathf.Cos(degree * Mathf.Deg2Rad) + center;
                    vertices[id].z = Mathf.Sqrt(Mathf.Pow((originalVert[id].x - center), 2) + (Mathf.Pow(originalVert[id].z, 2))) * -Mathf.Sin(degree * Mathf.Deg2Rad) + 0;

                    mesh.vertices = vertices;
                }
                degree += 36;

                // ゲームがポーズされたら
                while (playSystem.GetMenuPauseFlag())
                {
                    yield return(null);
                }

                yield return(new WaitForSeconds(0.1f));
            }
            break;

        case Side.BOTTOM:
            while (degree <= 180)
            {
                for (int id = 0; id < vertices.Length; id++)
                {
                    if (originalVert[id].y >= center)
                    {
                        continue;
                    }

                    vertices[id].y = Mathf.Sqrt(Mathf.Pow((originalVert[id].y - center), 2) + (Mathf.Pow(originalVert[id].z, 2))) * -Mathf.Cos(degree * Mathf.Deg2Rad) + center;
                    vertices[id].z = Mathf.Sqrt(Mathf.Pow((originalVert[id].y - center), 2) + (Mathf.Pow(originalVert[id].z, 2))) * -Mathf.Sin(degree * Mathf.Deg2Rad) + 0;

                    mesh.vertices = vertices;
                }
                degree += 36;

                // ゲームがポーズされたら
                while (playSystem.GetMenuPauseFlag())
                {
                    yield return(null);
                }

                yield return(new WaitForSeconds(0.1f));
            }
            break;

        case Side.UP:
            while (degree >= -180)
            {
                for (int id = 0; id < vertices.Length; id++)
                {
                    if (originalVert[id].y <= center)
                    {
                        continue;
                    }

                    vertices[id].y = Mathf.Sqrt(Mathf.Pow((originalVert[id].y - center), 2) + (Mathf.Pow(originalVert[id].z, 2))) * Mathf.Cos(degree * Mathf.Deg2Rad) + center;
                    vertices[id].z = Mathf.Sqrt(Mathf.Pow((originalVert[id].y - center), 2) + (Mathf.Pow(originalVert[id].z, 2))) * Mathf.Sin(degree * Mathf.Deg2Rad) + 0;

                    mesh.vertices = vertices;
                }
                degree -= 36;

                // ゲームがポーズされたら
                while (playSystem.GetMenuPauseFlag())
                {
                    yield return(null);
                }

                yield return(new WaitForSeconds(0.1f));
            }
            break;
        }

        yield return(new WaitForSeconds(1f));

        if (degree < -180)
        {
            degree = -180;
        }
        else if (degree > 180)
        {
            degree = 180;
        }
        // コピーしたい物のコードはここに!
        StartCoroutine(Unfolding(center));
    }
Пример #3
0
    IEnumerator DisplayTutorial()
    {
        while (!isActivated)
        {
            Debug.Log("Start of Iteration");
            switch (index)
            {
            case 0:
                Debug.Log("entering case");
                for (int i = 0; i < tutorials.Length; i++)
                {
                    Debug.Log("entering for" + i);
                    if (i == index)
                    {
                        tutorials[index].SetActive(true); Debug.Log("Activated");
                    }
                    else
                    {
                        tutorials[i].SetActive(false);
                    }
                }

                yield return(StartCoroutine(WaitForKeyDown()));

                break;

            case 1:
                for (int i = 0; i < tutorials.Length; i++)
                {
                    if (i == index)
                    {
                        tutorials[index].SetActive(true);
                    }
                    else
                    {
                        tutorials[i].SetActive(false);
                    }
                }

                yield return(StartCoroutine(WaitForKeyDown()));

                break;

            case 2:
                for (int i = 0; i < tutorials.Length; i++)
                {
                    if (i == index)
                    {
                        tutorials[index].SetActive(true);
                    }
                    else
                    {
                        tutorials[i].SetActive(false);
                    }
                }

                yield return(StartCoroutine(WaitForKeyDown()));

                break;
            }

            if (index <= 2)
            {
                Debug.Log("End of iteration"); yield return(new WaitForEndOfFrame());
            }
            else
            {
                playSystem.TranslucentPanelControl(false);
                isActivated = true;
                Debug.Log("play System " + playSystem.GetHeroStopFlag());
                Debug.Log("pause Flag " + playSystem.GetMenuPauseFlag());
                Debug.Log("Game Progress " + playSystem.GetProgress());

                foreach (GameObject x in tutorials)
                {
                    x.SetActive(false);
                }

                //Destroy(gameObject);
            }
        }
    }