Exemplo n.º 1
0
 //public CamPoint(Vector3 _pos, Vector3 _rot, CamAngle _camAngle)
 //{
 //    Pos = _pos;
 //    Rot = _rot;
 //    camAngle = _camAngle;
 //}
 public CamPoint(Transform obj, CamAngle _camAngle)
 {
     focus = obj;
     //Pos = obj.position;
     //Rot = obj.rotation.eulerAngles;
     camAngle = _camAngle;
 }
Exemplo n.º 2
0
//CURRENT VERSION
    public void Start()
    {
        game = FindObjectOfType(typeof(Game)) as Game;
        if (camObject != null)
        {
            if (useCamAngle)
            {
                camAngle = camObject.camAngle;
                distance = camAngle.distance;
                Vector3 tempVec = game.player.position + (game.player.forward * -camAngle.xzDistance);
                tempVec.y          = camAngle.positionHeight + game.abc.transform.position.y;
                transform.position = tempVec;

                //RUNGY, this is wrong...you should set the target pan instead
                //transform.forward = ((tempVec + transform.up * camAngle.cameraTargetHeight)-transform.position).normalized;
                if (!camAngle.usePlayerForward)
                {
                    transform.rotation = camAngle.rotation;
                }
            }
        }

        Vector3 angles = transform.eulerAngles;

        x = angles.y;
        y = angles.x;
        transform.rotation = Quaternion.Euler(y, x, 0.0f);
    }
Exemplo n.º 3
0
 public CamPoint(GameObject obj, CamAngle _camAngle)
 {
     focus = obj.transform;
     //Pos = obj.transform.position;
     //Rot = obj.transform.rotation.eulerAngles;
     camAngle = _camAngle;
 }
Exemplo n.º 4
0
    /// <summary>
    ///  앵글타입에 따른 사전에 정해진 포지션 반환
    /// </summary>
    /// <param name="_camAngle">앵글 타입</param>
    /// <returns></returns>
    Vector3 GetAngleRot(CamAngle _camAngle)
    {
        Vector3 angleRot = new Vector3();

        // 상단 앵글
        if (_camAngle == CamAngle.Top)
        {
            angleRot.x = 50;
            angleRot.y = 0;
            angleRot.z = 0;
        }
        // 하단 앵글
        else if (_camAngle == CamAngle.Middle)
        {
            angleRot.x = 10;
            angleRot.y = 0;
            angleRot.z = 0;
        }
        // 하단 앵글
        else if (_camAngle == CamAngle.Low)
        {
            angleRot.x = -10;
            angleRot.y = 0;
            angleRot.z = 0;
        }

        return(angleRot);
    }
Exemplo n.º 5
0
    /// <summary>
    ///  앵글타입에 따른 사전에 정해진 포지션 반환
    /// </summary>
    /// <param name="_camAngle">앵글 타입</param>
    /// <returns></returns>
    Vector3 GetAnglePos(CamAngle _camAngle)
    {
        Vector3 anglePos = new Vector3();

        // 상단 앵글
        if (_camAngle == CamAngle.Top)
        {
            anglePos.x = 0;
            anglePos.y = 45;
            anglePos.z = -30;
        }
        // 하단 앵글
        else if (_camAngle == CamAngle.Middle)
        {
            anglePos.x = 0;
            anglePos.y = 10;
            anglePos.z = -25;
        }
        // 하단 앵글
        else if (_camAngle == CamAngle.Low)
        {
            anglePos.x = 0;
            anglePos.y = 10;
            anglePos.z = -25;
        }

        return(anglePos);
    }
Exemplo n.º 6
0
    /// <summary>
    /// obj 에게 카메라 이동
    /// </summary>
    /// <param name="obj">타겟</param>
    /// <param name="_camAngle">적용할 앵글</param>
    public void CamMoveTo(Transform obj, CamAngle _camAngle)
    {
        // 사용 중단
        if (false)
        {
            // 메인 시점 움직임 가능처리
            if (obj == controller.cam)
            {
                controller.isFreeMode = true;
            }
            // 그 외 시점 움직임 불가능 처리
            else
            {
                controller.isFreeMode = false;
            }

            // 버튼, 자유모드 싱크
            LockBtn.isOn = !(controller.isFreeMode);
        }

        // 카메라 목표 저장
        camPoint = new CamPoint(obj, _camAngle);

        // 이동 적용
        if (LockBtn.isOn)
        {
            // 계층구조 변경
            Camera.main.transform.SetParent(obj);

            // 이동 명령
            CamMove(_camAngle);
        }
    }
Exemplo n.º 7
0
    void CamMove(CamAngle _camAngle)
    {
        // 위치 및 각도 확보
        Vector3 anglePos = GetAnglePos(_camAngle);
        Vector3 angleRot = GetAngleRot(_camAngle);

        //anglePos = anglePos + obj.position;
        //angleRot = angleRot + obj.rotation.eulerAngles;

        // 이전 요청 중지
        if (coroutinePos != null)
        {
            StopCoroutine(coroutinePos);
        }
        if (coroutineRot != null)
        {
            StopCoroutine(coroutineRot);
        }

        // 이동 및 회전
        coroutinePos = StartCoroutine(ChangePos(Camera.main.transform, anglePos));
        coroutineRot = StartCoroutine(ChangeRot(Camera.main.transform, angleRot));
    }
Exemplo n.º 8
0
 public CamAngleObject(CamAngle camAngle)
 {
     this.camAngle = camAngle;
 }
Exemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     camAngle = camAngleObject.camAngle;
 }