Пример #1
0
    private void ApplyResHandle()
    {
        if (!bStartEffect)
        {
            return;
        }

        if (LightingEffectResHandleInstance.isNullOrEmpry(ResHandleInstance))
        {
            needClose = true;
            return;
        }

        if (!ResHandleInstance.CameraAnimation)
        {
            needClose = true;
            return;
        }
        if (cameraConfig.attackType == EffectAttackType.Source)
        {
            if (EffectParam.nSrcEntityID != EntityFactory.MainHeroID)
            {
                needClose = true;
                return;
            }
        }
        else if (cameraConfig.attackType == EffectAttackType.Target)
        {
            if (EffectParam.nTargetEntityID != EntityFactory.MainHeroID)
            {
                needClose = true;
                return;
            }
        }
        else if (cameraConfig.attackType == EffectAttackType.SourceAndTarget)
        {
            if (EffectParam.nSrcEntityID != EntityFactory.MainHeroID && EffectParam.nTargetEntityID != EntityFactory.MainHeroID)
            {
                needClose = true;
                return;
            }
        }

        uint tick = GameLogicAPI.getTickCount();

        m_camera = SoldierCamera.MainInstance <SoldierCamera>();
        if (!m_camera)
        {
            needClose = true;
            return;
        }

        if (ResHandleInstance.CameraAnimation.animationClip)
        {
            Transform sourceTransform = null;
            if (EffectParam.srcObject)
            {
                sourceTransform = EffectParam.srcObject.transform;
            }
            CamAnimStateParam param = new CamAnimStateParam(ResHandleInstance.CameraAnimation.animationClip, cameraConfig.animationOrgPos, cameraConfig.animationOrgProjectFloor, EffectParam.targetPos, sourceTransform, cameraConfig.animationMainCamera);
            m_camera.EnableMode(CameraMode.CameraAnim, true, param);

            return;
        }

        m_camera.playEffect(cameraConfig.delayTick, cameraConfig.effectLiveTick, ResHandleInstance.CameraAnimation.cameraAxis, cameraConfig.recoverTransform);
    }