public void StartMoveCamera()
    {
        if (CamPathTest != null)
        {
            Debug.LogError("StartMoveCamera -> CamPathTest is not null");
            return;
        }

        if (IsInitChangeScreenOverlay)
        {
            return;
        }

        if (!IsInitCamPathInfo)
        {
            InitCamPathInfo();
        }

        CameraPathCtrl path = CamPath[PathArray[PathMoveNum]];

        if (path == null)
        {
            Debug.LogError("path should not null, PathMoveNum = " + PathMoveNum);
            return;
        }
        //MoveCamera(path);

        PathMoveNum++;
        clickStartBtOne();
    }
Example #2
0
    void OnDrawGizmosSelected()
    {
        if (!enabled)
        {
            return;
        }

        Transform parTran = transform.parent;

        if (parTran == null)
        {
            return;
        }

        CameraPathCtrl pathScript = parTran.GetComponent <CameraPathCtrl>();

        pathScript.DrawPath();
    }
    void MoveCamera(CameraPathCtrl path)
    {
        if (path == null)
        {
            Debug.LogError("MoveCamera -> path is null!");
            return;
        }
        NoiseScript.enabled = false;

        if (path.IsOnlyChangeRot)
        {
            TweenTransform TweenTranscript = GmObj.GetComponent <TweenTransform>();
            if (TweenTranscript == null)
            {
                TweenTranscript = gameObject.AddComponent <TweenTransform>();
            }
            TweenTranscript.enabled = false;

            GmTran.position = path.CamRotation_1.position;
            GmTran.rotation = path.CamRotation_1.rotation;

            TweenTranscript.from     = path.CamRotation_1;
            TweenTranscript.to       = path.CamRotation_2;
            TweenTranscript.duration = path.TimeVal;
            TweenTranscript.style    = UITweener.Style.Once;
            TweenTranscript.ResetToBeginning();

            EventDelegate.Add(TweenTranscript.onFinished, delegate {
                OnFinishMoveCamera();
            });

            TweenTranscript.enabled = true;
            TweenTranscript.PlayForward();
        }
        else if (path.IsMvPosByCamPath)
        {
            GmTran.position = path.GetCamPathTranFirst().position;
            GmTran.rotation = path.GetCamPathTranFirst().rotation;

            iTween.MoveTo(GmObj, iTween.Hash("path", path.GetCamPathTranArray(),
                                             "time", path.TimeVal,
                                             "easeType", iTween.EaseType.linear,
                                             "oncomplete", "OnFinishMoveCamera"));
        }
        else if (path.IsMvRotByCamPath)
        {
            GmTran.position = path.GetCamPathTranFirst().position;
            GmTran.rotation = path.GetCamPathTranFirst().rotation;

            iTween.MoveTo(GmObj, iTween.Hash("path", path.GetCamPathTranArray(),
                                             "time", path.TimeVal,
                                             "orienttopath", true,
                                             "easeType", iTween.EaseType.linear,
                                             "oncomplete", "OnFinishMoveCamera"));
        }
        else if (path.IsMvAimByCamPath)
        {
            GmTran.position = path.GetCamPathTranFirst().position;
            GmTran.rotation = path.GetCamPathTranFirst().rotation;

            iTween.MoveTo(GmObj, iTween.Hash("path", path.GetCamPathTranArray(),
                                             "time", path.TimeVal,
                                             "looktarget", path.CamAimPoint,
                                             "easeType", iTween.EaseType.linear,
                                             "oncomplete", "OnFinishMoveCamera"));
        }
    }