Example #1
0
 public MainCameraFollowState(MonoMainCamera camera) : base(camera)
 {
     this.anchorRadius                 = 6f;
     this.cameraLocateRatio            = 0.535f;
     this.posLerpRatio                 = 1f;
     this.forwardLerpRatio             = 1f;
     base.lerpDirectionalLight         = true;
     this.followData                   = new FollowData();
     this.rotateToAvatarFacingState    = new FollowRotateToAvatarFacing(this);
     this.standByState                 = new FollowStandBy(this);
     this.lookAtPositionState          = new FollowLookAtPosition(this);
     this.rangeTransitState            = new FollowRangeTransit(this);
     this.timedPullZState              = new FollowTimedPullZ(this);
     this.suddenChangeState            = new FollowSuddenChange(this);
     this.suddenRecoverState           = new FollowSuddenRecover(this);
     this.slowMotionKillState          = new FollowSlowMotionKill(this);
     this.followAvatarState            = new FollowAvatarPoleState(this);
     this.followAvatarAndTargetState   = new FollowAvatarAndTargetState(this);
     this.followAvatarAndBossState     = new FollowAvatarAndBossState(this);
     this.followAvatarAndCrowdState    = new FollowAvatarAndCrowdState(this);
     this.followAvatarControlledRotate = new FollowAvatarControlledRotate(this);
     this.recoverState                 = new FollowRecovering(this);
     this.anchorRadius                 = 6f;
     this.followCenterY                = 1.2f;
     this.anchorElevation              = MainCameraData.CAMERA_DEFAULT_ELEVATION_DEGREE;
     this.forwardDeltaAngle            = 0f;
     base.cameraFOV = this.mainCamera.originalFOV;
     this.recoverState.SetupRecoverRadius(this.anchorRadius);
     this.recoverState.SetupRecoverCenterY(this.followCenterY);
     this.recoverState.SetupRecoverElevation(this.anchorElevation);
     this.recoverState.SetupRecoverForwardDelta(this.forwardDeltaAngle);
     this.recoverState.SetupRecoverLerpPosRatio(1f);
     this.recoverState.SetupRecoverLerpForwardRatio(1f);
     this.recoverState.SetupRecoverFOV(base.cameraFOV);
 }
        private bool ListenKilled(EvtKilled evt)
        {
            AvatarActor actor = Singleton <EventManager> .Instance.GetActor <AvatarActor>(evt.killerID);

            MonsterActor actor2 = Singleton <EventManager> .Instance.GetActor <MonsterActor>(evt.targetID);

            MonoMainCamera mainCamera = Singleton <CameraManager> .Instance.GetMainCamera();

            if ((((actor != null) && (actor2 != null)) && (Singleton <AvatarManager> .Instance.IsLocalAvatar(actor.runtimeID) && (Singleton <MonsterManager> .Instance.LivingMonsterCount() == 0))) && mainCamera.followState.slowMotionKillState.active)
            {
                if (string.IsNullOrEmpty(evt.killerAnimEventID) || !actor.config.AnimEvents.ContainsKey(evt.killerAnimEventID))
                {
                    return(false);
                }
                AttackResult.AttackCategoryTag[] categoryTag = actor.config.AnimEvents[evt.killerAnimEventID].AttackProperty.CategoryTag;
                if (categoryTag == null)
                {
                    return(false);
                }
                bool flag = false;
                for (int i = 0; i < categoryTag.Length; i++)
                {
                    if (categoryTag[i] == AttackResult.AttackCategoryTag.SwitchIn)
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    this.Finish();
                }
            }
            return(false);
        }
Example #3
0
 public void Init(Transform actor)
 {
     this._anchor.parent              = actor;
     this._anchor.localPosition       = Vector3.zero;
     this._anchor.localRotation       = Quaternion.identity;
     this._characterTrackGroup.Actor  = actor;
     this._cutScene.CutsceneFinished += new CutsceneHandler(this.CutsceneFinished);
     this._mainCamera = Singleton <CameraManager> .Instance.GetMainCamera();
 }
Example #4
0
        public void DisableBossCamera()
        {
            MonoMainCamera mainCamera = Singleton <CameraManager> .Instance.GetMainCamera();

            mainCamera.followState.TransitBaseState(mainCamera.followState.followAvatarState, true);
            if (!mainCamera.followState.isCameraLocateRatioUserDefined)
            {
                mainCamera.SetCameraLocateRatio(0.535f);
            }
        }
Example #5
0
        public bool ListenKill(EvtKilled evt)
        {
            MonoMainCamera mainCamera = Singleton <CameraManager> .Instance.GetMainCamera();

            if ((mainCamera.followState.active && mainCamera.followState.followAvatarAndBossState.active) && (mainCamera.followState.followAvatarAndBossState.bossTarget.GetRuntimeID() == evt.targetID))
            {
                Singleton <CameraManager> .Instance.DisableBossCamera();
            }
            return(true);
        }
Example #6
0
        public override void Init(BaseMonoEntity entity)
        {
            this._mainCamera    = (MonoMainCamera)entity;
            base.runtimeID      = this._mainCamera.GetRuntimeID();
            this._closeUpPlugin = new CameraActorLastKillCloseUpPlugin(this);
            Singleton <EventManager> .Instance.RegisterEventListener <EvtAvatarCreated>(base.runtimeID);

            Singleton <EventManager> .Instance.RegisterEventListener <EvtStageReady>(base.runtimeID);

            Singleton <EventManager> .Instance.RegisterEventListener <EvtKilled>(base.runtimeID);
        }
Example #7
0
 public MainCameraStoryState(MonoMainCamera camera) : base(camera)
 {
     this._backFollowState = true;
     this._quitWithFadeIn  = true;
     this.anchorRadius     = 6f;
     this.yOffset          = 1f;
     this.fov                   = 60f;
     this.ParallexRange         = 5f;
     this.ParallexSensitivity   = 0.1f;
     this.ParallexBoundHardness = 0.5f;
     this.LoadBlurData();
 }
Example #8
0
        private void ShowLastKillCameraEffect(BaseMonoMonster monster)
        {
            BaseMonoAvatar avatar = Singleton <AvatarManager> .Instance.TryGetLocalAvatar();

            Vector3 vector    = monster.XZPosition - avatar.XZPosition;
            float   magnitude = vector.magnitude;
            string  filePath  = (Singleton <MonsterManager> .Instance.LivingMonsterCount() != 0) ? "SlowMotionKill/Normal" : "SlowMotionKill/LastKill";
            ConfigCameraSlowMotionKill config     = ConfigUtil.LoadConfig <ConfigCameraSlowMotionKill>(filePath);
            MonoMainCamera             mainCamera = Singleton <CameraManager> .Instance.GetMainCamera();

            Vector3 vector2    = mainCamera.XZPosition - avatar.XZPosition;
            float   distCamera = vector2.magnitude;

            mainCamera.SetSlowMotionKill(config, magnitude, distCamera);
        }
Example #9
0
        private void HandleAlreadyLoadedCameras()
        {
            RuntimeIDManager instance      = Singleton <RuntimeIDManager> .Instance;
            MonoMainCamera   camera        = UnityEngine.Object.FindObjectOfType <MonoMainCamera>();
            uint             nextRuntimeID = instance.GetNextRuntimeID(2);

            camera.Init(nextRuntimeID);
            Singleton <CameraManager> .Instance.RegisterCameraData(1, camera, nextRuntimeID);

            MonoInLevelUICamera camera2 = UnityEngine.Object.FindObjectOfType <MonoInLevelUICamera>();

            nextRuntimeID = instance.GetNextRuntimeID(2);
            camera2.Init(nextRuntimeID);
            Singleton <CameraManager> .Instance.RegisterCameraData(2, camera2, nextRuntimeID);
        }
Example #10
0
        public void EnableBossCamera(uint targetId)
        {
            BaseMonoEntity monsterByRuntimeID = Singleton <MonsterManager> .Instance.GetMonsterByRuntimeID(targetId);

            if (monsterByRuntimeID != null)
            {
                MonoMainCamera mainCamera = Singleton <CameraManager> .Instance.GetMainCamera();

                mainCamera.followState.TransitBaseState(mainCamera.followState.followAvatarAndBossState, false);
                mainCamera.followState.followAvatarAndBossState.bossTarget = monsterByRuntimeID;
                if (!mainCamera.followState.isCameraLocateRatioUserDefined)
                {
                    mainCamera.SetCameraLocateRatio(0.735f);
                }
            }
        }
Example #11
0
 public MainCameraLevelAnimState(MonoMainCamera camera) : base(camera)
 {
     this._nextState          = camera.staticState;
     this._exitTransitionLerp = false;
     base.muteCameraShake     = false;
 }
Example #12
0
        public override void Update()
        {
            if (this.needLPF)
            {
                for (int i = this._lastFollowCenters.Length - 1; i > 0; i--)
                {
                    this._lastFollowCenters[i] = this._lastFollowCenters[i - 1];
                }
                this._lastFollowCenters[0] = this.followCenterXZPosition;
            }
            Vector3 followCenterXZPosition = this.followCenterXZPosition;

            this.followCenterXZPosition = this.avatar.XZPosition;
            Vector3 vector2 = followCenterXZPosition - this.followCenterXZPosition;

            this.needLerpPositionThisFrame       = true;
            this.needLerpForwardThisFrame        = true;
            this.needSmoothFollowCenterThisFrame = false;
            this.SubStateTransitionUpdate();
            if (this.recoverState.active)
            {
                this.recoverState.Update();
            }
            if (this._nextBaseState != null)
            {
                this._baseState.Exit();
                this._baseState.SetActive(false);
                this.lastBaseState = this._baseState;
                this._baseState    = this._nextBaseState;
                this._baseState.Enter();
                this._baseState.SetActive(true);
                this._nextBaseState = null;
                if ((this._shortState != null) && this._baseState.maskedShortStates.Contains(this._shortState))
                {
                    this.RemoveShortState();
                }
            }
            if (this._shortState != null)
            {
                this._shortState.Update();
                bool isSkippingBaseState = false;
                if (this._shortState != null)
                {
                    isSkippingBaseState = this._shortState.isSkippingBaseState;
                }
                if (!isSkippingBaseState || this._baseState.cannotBeSkipped)
                {
                    this._baseState.Update();
                }
                if (this._shortState != null)
                {
                    this._shortState.PostUpdate();
                }
            }
            else
            {
                this._baseState.Update();
            }
            if (this.needLPF && this.needSmoothFollowCenterThisFrame)
            {
                Vector3 vector3 = this.followCenterXZPosition;
                for (int j = 0; j < this._lastFollowCenters.Length; j++)
                {
                    vector3 += this._lastFollowCenters[j];
                }
                this.followCenterXZPosition = (Vector3)(vector3 / ((float)(this._lastFollowCenters.Length + 1)));
                UnityEngine.Debug.DrawLine(this.followCenterXZPosition, this.followCenterXZPosition + Vector3.up);
            }
            this.ConvertToFollowData();
            Vector3 cameraPosition = this.followData.cameraPosition;
            Vector3 cameraForward  = this.followData.cameraForward;
            Vector3 vector6        = cameraPosition - this.followData.followCenterPosition;
            float   magnitude      = vector6.magnitude;

            if (Physics.Raycast(this.followData.followCenterPosition, -this.followData.cameraForwardNoForwardDelta, out this._wallHit, magnitude, ((int)1) << InLevelData.CAMERA_COLLIDER_LAYER))
            {
                float num4 = magnitude - this._wallHit.distance;
                cameraPosition    = Vector3.Lerp(this._wallHit.point, cameraPosition, 0.1f);
                cameraPosition.y += num4 * 0.1f;
                base._owner.cameraComponent.nearClipPlane = Mathf.Lerp(base._owner.originalNearClip, 0.01f, num4 / magnitude);
                Vector3 axis = Vector3.Cross(Vector3.up, base.cameraForward);
                cameraForward = (Vector3)(Quaternion.AngleAxis((0.05f * num4) * 57.29578f, axis) * cameraForward);
                cameraForward.Normalize();
                base.cameraShakeRatio = 1f - (num4 / magnitude);
            }
            else
            {
                base._owner.cameraComponent.nearClipPlane = base._owner.originalNearClip;
            }
            float num5 = Time.deltaTime * base._owner.TimeScale;
            float num6 = (num5 != 0f) ? (vector2.magnitude / Time.deltaTime) : 0f;
            float num7 = Miscs.NormalizedClamp(num6, 5f, 12f);

            if (this.needLerpPositionThisFrame)
            {
                float   num8     = ((Time.deltaTime * 7.9f) * (1f + num7)) * this.posLerpRatio;
                Vector3 a        = base.cameraPosition - this.followData.followCenterPosition;
                Vector3 b        = cameraPosition - this.followData.followCenterPosition;
                Vector3 vector10 = Vector3.Slerp(a, b, Mathf.Clamp01(num8));
                base.cameraPosition = vector10 + this.followData.followCenterPosition;
                this.lerpPositionOvershootLastFrame = num8 >= 1f;
            }
            else
            {
                base.cameraPosition = cameraPosition;
            }
            if (this.needLerpForwardThisFrame)
            {
                float num9 = ((Time.deltaTime * 5f) * (1f + num7)) * this.forwardLerpRatio;
                this.cameraForward.Normalize();
                cameraForward.Normalize();
                base.cameraForward = MonoMainCamera.CameraForwardLerp(base.cameraForward, cameraForward, Mathf.Clamp01(num9));
                this.lerpForwardOvershootLastFrame = num9 >= 1f;
            }
            else if (this.focusOnAvatar)
            {
                Vector3 vector11 = this.followData.followCenterPosition - base.cameraPosition;
                base.cameraForward = vector11;
                this.cameraForward.Normalize();
            }
            else
            {
                base.cameraForward = cameraForward;
            }
            if (base.cameraFOV > 0f)
            {
                base._owner.cameraComponent.fieldOfView = base.cameraFOV;
            }
        }
Example #13
0
        public void EnableCrowdCamera()
        {
            MonoMainCamera mainCamera = Singleton <CameraManager> .Instance.GetMainCamera();

            mainCamera.followState.TransitBaseState(mainCamera.followState.followAvatarAndCrowdState, false);
        }
Example #14
0
        public void DisableCrowdCamera()
        {
            MonoMainCamera mainCamera = Singleton <CameraManager> .Instance.GetMainCamera();

            mainCamera.followState.TransitBaseState(mainCamera.followState.followAvatarState, true);
        }
Example #15
0
 public MainCameraAvatarAnimState(MonoMainCamera camera) : base(camera)
 {
     this._nextState          = base._owner.followState;
     this._exitTransitionLerp = false;
 }
Example #16
0
 public MainCameraStaticState(MonoMainCamera camera) : base(camera)
 {
 }
Example #17
0
 public MainCameraCinemaState(MonoMainCamera camera) : base(camera)
 {
 }