Esempio n. 1
0
        // 画面再描画イベントみたいなもの。
        // たまに呼び出される。
        public void OnUpdate()
        {
            // キー状態の確認。
            // キーイベントみたいなものにハンドラを登録する訳ではないので、
            // なんかしたい人はとにかくOnUpdateで処理を書く。
            if (Input.GetKeyDown(KeyCode.F6))
            {
                Boolean isShift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
                if (isShift)
                {
                    // CameraControlクラスはIllusionさん作成のクラス。
                    // カメラの制御に関する各種制御を持っているのでこれを利用してカメラの制御をする。
                    // unityの世界のメソッドだけで処理しようとするとうまくいかない事があるのでがんばれ!
                    // CameraやVectory3dはunityのものです。
                    // illusionのものとunityのものがごっちゃごちゃになっています。
                    // Camera.mainはメインカメラです。これはUnityの機能で提供されています。
                    Studio.CameraControl component2 = Camera.main.GetComponent <Studio.CameraControl>();
                    component2.cameraAngle += new Vector3(0, 0, 270);
                }
                else
                {
                    Studio.CameraControl component2 = Camera.main.GetComponent <Studio.CameraControl>();
                    component2.cameraAngle += new Vector3(0, 0, 90);
                }
            }

            if (Input.GetKeyDown(KeyCode.F7))
            {
                Boolean isShift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
                Studio.CameraControl component = Camera.main.GetComponent <Studio.CameraControl>();
                if (isShift)
                {
                    component.SetCamera(new Vector3(0, getHeight(), 0), Vector3.zero, Quaternion.identity, Vector3.zero);

                    Studio.CameraControl component2 = Camera.main.GetComponent <Studio.CameraControl>();
                    component2.SetCamera(new Vector3(0, getHeight(), 0), new Vector3(0, 0, 0), Quaternion.identity, new Vector3(0, 0, (-1) * getDistance()));
                    component2.transform.Rotate(new Vector3(0, 0, 0));
                    component2.targetPos = new Vector3(0, getHeight(), 0);
                }
                else
                {
                    component.SetCamera(new Vector3(0, getHeight(), 0), Vector3.zero, Quaternion.identity, Vector3.zero);

                    Studio.CameraControl component2 = Camera.main.GetComponent <Studio.CameraControl>();
                    component2.SetCamera(new Vector3(0, getHeight(), 0), new Vector3(0, 180, 0), Quaternion.identity, new Vector3(0, 0, (-1) * getDistance()));
                    component2.transform.Rotate(new Vector3(0, 180, 0));
                    component2.targetPos = new Vector3(0, getHeight(), 0);
                }
            }
            if (Input.GetKeyDown(KeyCode.F8))
            {
                Boolean isShift = Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift);
                try
                {
                    Studio.CameraControl component = Camera.main.GetComponent <Studio.CameraControl>();
                    if (isShift)
                    {
                        component.SetCamera(new Vector3(0, getHeight(), 0), Vector3.zero, Quaternion.identity, Vector3.zero);

                        Studio.CameraControl component2 = Camera.main.GetComponent <Studio.CameraControl>();
                        component2.SetCamera(new Vector3(0, getHeight(), 0), new Vector3(0, 90, 0), Quaternion.identity, new Vector3(0, 0, (-1) * getDistance()));
                        component2.transform.Rotate(new Vector3(0, 90, 0));
                        component2.targetPos = new Vector3(0, getHeight(), 0);
                    }
                    else
                    {
                        component.SetCamera(new Vector3(0, getHeight(), 0), Vector3.zero, Quaternion.identity, Vector3.zero);

                        Studio.CameraControl component2 = Camera.main.GetComponent <Studio.CameraControl>();
                        component2.SetCamera(new Vector3(0, getHeight(), 0), new Vector3(0, 270, 0), Quaternion.identity, new Vector3(0, 0, (-1) * getDistance()));
                        component2.transform.Rotate(new Vector3(0, 270, 0));
                        component2.targetPos = new Vector3(0, getHeight(), 0);
                    }
                }
                catch (Exception e)
                {
                }
            }
        }