예제 #1
0
    /// <summary>
    /// タブレットのTransformを指定角まで移動させる
    /// </summary>
    /// <param name="target">移動対象のオブジェクト</param>
    /// <param name="endRotation">回転先のオイラー角</param>
    /// <param name="isReverse">回転方向(trueにすると負の方向に回転)</param>///
    private IEnumerator TabletMovement(Transform target, Vector3 endRotation, bool isReverse = false)
    {
        tabletMoveState = TabletMoveState.midstream;

        Vector3    startRotation = target.localEulerAngles;
        Quaternion endQuaternion = new Quaternion();

        endQuaternion.eulerAngles = endRotation;

        int direction = 1;

        if (isReverse)
        {
            direction = -1;
        }

        float startTime = Time.time;

        while ((Mathf.Acos(Vector3.Dot(((target.localRotation * Vector3.forward) * direction), endQuaternion * Vector3.forward)) * 180.0f / Mathf.PI) > 0.1f)
        {
            float diff = Time.time - startTime;
            target.localEulerAngles = Vector3.Slerp(startRotation, endRotation, diff / 0.5f) * direction;
            yield return(new WaitForSeconds(0.002f));
        }

        tabletMoveState = TabletMoveState.after;
    }
예제 #2
0
    private void Initialize()
    {
        canvas     = GameObject.Find("Canvas");
        isPause    = false;
        pauseState = PauseState.None;

        if (tabletPCPrefab == null)
        {
            tabletPCPrefab = Resources.Load <GameObject>("Prefabs/TabletPC");
        }

        tabletPC = GameObject.Find("TabletPCPoint") as GameObject;

        var tabletPCAxisGo = GameObject.Find("TabletPCAxis");

        if (tabletPCAxisGo)
        {
            tabletPCAxis = tabletPCAxisGo.transform as Transform;
        }
        initTabletPCAxis = tabletPCAxis;

        if (tabletPC != null)
        {
            tabletTransform = tabletPC.transform;
        }
        tabletMoveState = TabletMoveState.before;
        isInitialized   = true;
    }
예제 #3
0
    private void ToGo()
    {
        isPause = true;
        Pauser.Pause();

        Vector3 targetEulerAngles = new Vector3(90.0f, 0.0f, 0.0f);

        if (tabletMoveState == TabletMoveState.before && Application.loadedLevelName != Scenes.EndScene.name)
        {
            tabletPC = Instantiate(tabletPCPrefab, tabletTransform.position, tabletTransform.rotation) as GameObject;
            tabletPC.transform.parent = tabletTransform;

            StartCoroutine(TabletMovement(tabletPCAxis, targetEulerAngles, true));
            player.ShowMiniMap(false);
            ExamineIconManager.SetVisible(false);
        }

        if (tabletMoveState == TabletMoveState.after)
        {
            pauseState       = PauseState.Run;
            tabletMoveState  = TabletMoveState.before;
            Cursor.visible   = true;
            Cursor.lockState = CursorLockMode.None;
        }
    }
예제 #4
0
    private void ToBack()
    {
        if (menu != null)
        {
            Destroy(menu.gameObject);
        }

        if (tabletScreen && tabletScreen.GetComponent <MeshRenderer>().material.color != EndScreenColor)
        {
            tabletScreen.GetComponent <MeshRenderer>().material.color = EndScreenColor;
        }

        Vector3 targetEulerAngles = new Vector3(360.0f, 0.0f, 0.0f);

        if (tabletPCAxis.localEulerAngles.x != 0 && tabletMoveState == TabletMoveState.before)
        {
            StartCoroutine(TabletMovement(tabletPCAxis, targetEulerAngles));
        }

        if (tabletMoveState == TabletMoveState.after)
        {
            if (tabletPCAxis.localEulerAngles != targetEulerAngles)
            {
                tabletPCAxis.localEulerAngles = targetEulerAngles;
            }

            if (tabletPC != null)
            {
                Destroy(tabletPC);
            }

            pauseState       = PauseState.None;
            tabletMoveState  = TabletMoveState.before;
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
            Pauser.Resume();
            isPause = false;
            player.ShowMiniMap(true);
            ExamineIconManager.SetVisible(true);
        }
    }
예제 #5
0
    private void Initialize()
    {
        if (Application.loadedLevelName == Scenes.Menu.name || !player.ContainsItem(Items.Tablet) || AdvancedWriteMessageSingleton.instance.isWrite)
        {
            return;
        }

        canvas     = GameObject.Find("Canvas");
        isPause    = false;
        pauseState = PauseState.None;

        if (tabletPCPrefab == null)
        {
            tabletPCPrefab = Resources.Load <GameObject>("Prefabs/TabletPC");
        }
        tabletPC         = GameObject.Find("TabletPCPoint") as GameObject;
        tabletPCAxis     = GameObject.Find("TabletPCAxis").transform as Transform;
        initTabletPCAxis = tabletPCAxis;
        tabletTransform  = tabletPC.transform;
        tabletMoveState  = TabletMoveState.before;
        isInitialized    = true;
    }