Beispiel #1
0
        public void RefreshAutoRotate()
        {
            Camera cam           = TopDownCamera.GetCamera();
            float  current_angle = transform.rotation.eulerAngles.z;

            if (!cam.orthographic)
            {
                //Projection
                transform.rotation = Quaternion.Euler(cam.transform.rotation.eulerAngles.x, 0f, current_angle);
                transform.position = new Vector3(transform.position.x, transform.position.y, GetRotateZOffset());
            }
            else
            {
                //Ortho
                transform.rotation = Quaternion.Euler(0f, 0f, current_angle);
                transform.position = new Vector3(transform.position.x, transform.position.y, 0f);
            }
        }
        public void RefreshRender()
        {
            //Rotation
            if (auto_rotate)
            {
                Camera cam = TopDownCamera.GetCamera();

                if (!cam.orthographic)
                {
                    transform.rotation = Quaternion.Euler(start_rot + Vector3.right * cam.transform.rotation.eulerAngles.x);
                    transform.position = new Vector3(transform.position.x, transform.position.y, -rotate_offset * transform.lossyScale.y);
                }
                else
                {
                    transform.rotation = Quaternion.Euler(start_rot);
                    transform.position = new Vector3(transform.position.x, transform.position.y, 0f);
                }
            }
        }
Beispiel #3
0
 void Awake()
 {
     _instance = this;
     cam       = GetComponent <Camera>();
 }