Exemplo n.º 1
0
    private void RefreshRotation(RTManager.RtType type, bool bEnable)
    {
        if (CamerasMgr.Camera2RTCommon == null)
        {
            return;
        }
        if (!bEnable)
        {
            return;
        }
        switch (type)
        {
        case RTManager.RtType.Player:
            this.RotateBaseCamera();
            break;

        case RTManager.RtType.ActorModel1:
            this.RotateBaseModel();
            break;

        case RTManager.RtType.InstanceBall:
            this.RotateInstanceBall();
            break;
        }
    }
Exemplo n.º 2
0
 private void SetCameraCullingMask(RTManager.RtType type, bool typeOn, int mask = 2)
 {
     if (typeOn)
     {
         CamerasMgr.EnableRTC(true);
         this.CullingMasks.set_Item(type, mask);
         RTManager.CurrentRtType = type;
     }
     else
     {
         this.CullingMasks.Remove(type);
         if (this.CullingMasks.get_Count() == 0)
         {
             CamerasMgr.EnableRTC(false);
             RTManager.CurrentRtType = RTManager.RtType.None;
         }
         else
         {
             RTManager.CurrentRtType = RTManager.RtType.LocalHeatDistortion;
         }
     }
     this.SetSLightRotation();
     if (RTManager.CurrentRtType == RTManager.RtType.None)
     {
         CamerasMgr.SetRTCCullingMask(0);
     }
     else
     {
         CamerasMgr.SetRTCCullingMask(this.CullingMasks.get_Item(RTManager.CurrentRtType));
         if (CamerasMgr.Camera2RTCommon != null)
         {
             CamerasMgr.Camera2RTCommon.set_backgroundColor(new Color(0f, 0f, 0f, 0f));
         }
     }
 }
Exemplo n.º 3
0
 public void EnableProjectionType(bool bOn, RTManager.RtType type)
 {
     if (bOn && type == RTManager.RtType.LocalHeatDistortion && RTManager.CurrentRtType != RTManager.RtType.None && RTManager.CurrentRtType != RTManager.RtType.LocalHeatDistortion)
     {
         return;
     }
     this.SetCameraParentNode(bOn && type != RTManager.RtType.LocalHeatDistortion);
     this.SetCameraRenderType(type, bOn);
     this.SetCameraPosition(type, bOn);
     this.RefreshRotation(type, bOn);
 }
Exemplo n.º 4
0
    public void SetCameraPosition(RTManager.RtType type, bool bEnable)
    {
        if (CamerasMgr.Camera2RTCommon == null)
        {
            Debug.LogError("CamerasMgr.Camera2RTCommon == null***********************");
            return;
        }
        if (!bEnable)
        {
            return;
        }
        switch (type)
        {
        case RTManager.RtType.LocalHeatDistortion:
            CamerasMgr.Camera2RTCommon.get_transform().set_localPosition(Vector3.get_zero());
            CamerasMgr.Camera2RTCommon.get_transform().set_localScale(Vector3.get_one());
            CamerasMgr.Camera2RTCommon.get_transform().set_localRotation(Quaternion.get_identity());
            break;

        case RTManager.RtType.Player:
        {
            if (this.AimTarget == null)
            {
                Debug.LogError("AimTarget is null");
                return;
            }
            Quaternion rotation = this.AimTarget.get_rotation();
            this.playerTmpPosition = this.AimTarget.get_position();
            Vector3 vector    = rotation * RTManager.Instance.CamProjRotateRevise;
            Vector3 position  = vector + RTManager.Instance.AimTarget.get_transform().get_position();
            Vector3 position2 = this.AimTarget.get_transform().get_position();
            position2.y += this.AimTargetOffsetY;
            CamerasMgr.Camera2RTCommon.get_transform().set_position(position);
            CamerasMgr.Camera2RTCommon.get_transform().LookAt(position2);
            break;
        }

        case RTManager.RtType.ActorModel1:
            if (this.AimTarget != null)
            {
                ModelDisplayManager.CameraSettingOfActorModel(CamerasMgr.Camera2RTCommon, this.CamProjRotateRevise, this.AimTargetOffsetY, 0f);
            }
            break;

        case RTManager.RtType.InstanceBall:
            if (this.AimTarget != null && ModelDisplayManager.Instance.goTerrestrialGlobe != null)
            {
                Vector3 position3 = ModelDisplayManager.Instance.goTerrestrialGlobe.get_transform().FindChild("CameraLookAtPlace").get_position();
                Vector3 position4 = ModelDisplayManager.Instance.goTerrestrialGlobe.get_transform().FindChild("CameraPlace").get_position();
                CamerasMgr.Camera2RTCommon.get_transform().set_position(position4);
                CamerasMgr.Camera2RTCommon.get_transform().LookAt(position3);
            }
            break;

        case RTManager.RtType.ElementBall:
            if (this.AimTarget != null && ModelDisplayManager.Instance.elementBall != null)
            {
                Vector3 position5 = ModelDisplayManager.Instance.elementBall.get_transform().FindChild("CameraLookAtPlace").get_position();
                Vector3 position6 = ModelDisplayManager.Instance.elementBall.get_transform().FindChild("CameraPlace").get_position();
                CamerasMgr.Camera2RTCommon.get_transform().set_position(position6);
                CamerasMgr.Camera2RTCommon.get_transform().LookAt(position5);
                if (BallElement.Instance.distanceVisable == 0f)
                {
                    BallElement.Instance.CalDistance();
                }
            }
            break;
        }
    }
Exemplo n.º 5
0
    private void SetCameraRenderType(RTManager.RtType type, bool typeOn)
    {
        this.ResetRotation();
        switch (type)
        {
        case RTManager.RtType.LocalHeatDistortion:
        {
            string[] array = new string[]
            {
                "FX_Distortion"
            };
            int mask = LayerMask.GetMask(array);
            this.SetCameraCullingMask(type, typeOn, mask);
            break;
        }

        case RTManager.RtType.Player:
        {
            if (EntityWorld.Instance.ActSelf != null)
            {
                ShadowController.ShowShadow(EntityWorld.Instance.EntSelf.ID, EntityWorld.Instance.ActSelf, typeOn, 0);
            }
            string[] layerNames = new string[]
            {
                "CameraRange"
            };
            int mask2 = LayerSystem.GetMask(layerNames);
            this.SetCameraCullingMask(type, typeOn, mask2);
            if (typeOn)
            {
                this.AimTargetOffsetY = ModelDisplayManager.GetPlayerAM().camProjPosRevise;
                if (ModelDisplayManager.GetPlayerAM().camProjRotRevise.get_Count() >= 2)
                {
                    RTManager.Instance.CamProjRotateRevise = new Vector3(0f, ModelDisplayManager.GetPlayerAM().camProjRotRevise.get_Item(0), ModelDisplayManager.GetPlayerAM().camProjRotRevise.get_Item(1));
                }
            }
            break;
        }

        case RTManager.RtType.ActorModel1:
            this.SetCameraCullingMask(type, typeOn, ModelDisplayManager.ModelFXMask);
            if (!typeOn)
            {
                this.HideModel();
                CamerasMgr.SetRTCClippingPlanes(0f);
            }
            else
            {
                CamerasMgr.SetRTCClippingPlanes(100000f);
            }
            break;

        case RTManager.RtType.InstanceBall:
        {
            string[] layerNames2 = new string[]
            {
                "BallItem",
                "BallObject"
            };
            int mask3 = LayerSystem.GetMask(layerNames2);
            this.SetCameraCullingMask(type, typeOn, mask3);
            if (!typeOn)
            {
                this.HideModel();
            }
            break;
        }

        case RTManager.RtType.ElementBall:
        {
            string[] layerNames3 = new string[]
            {
                "BallItem",
                "BallObject"
            };
            int mask4 = LayerSystem.GetMask(layerNames3);
            this.SetCameraCullingMask(type, typeOn, mask4);
            if (!typeOn)
            {
                this.HideModel();
            }
            break;
        }
        }
    }