Beispiel #1
0
        public virtual TaskStatus OnUpdate()
        {
            AgentActor agent = this.Agent;

            agent.StopNavMeshAgent();
            agent.ChangeStaticNavMeshAgentAvoidance();
            agent.CurrentPoint = agent.TargetInSightActionPoint;
            agent.SetActiveOnEquipedItem(false);
            agent.ChaControl.setAllLayerWeight(0.0f);
            agent.ElectNextPoint();
            if (Object.op_Equality((Object)agent.CurrentPoint, (Object)null))
            {
                this.ClearDesire(agent);
                return((TaskStatus)2);
            }
            agent.CurrentPoint.SetActiveMapItemObjs(false);
            WarpPoint currentPoint = agent.CurrentPoint as WarpPoint;

            if (Object.op_Equality((Object)currentPoint, (Object)null))
            {
                agent.CurrentPoint = (ActionPoint)null;
                this.ClearDesire(agent);
                return((TaskStatus)2);
            }
            WarpPoint warpPoint = currentPoint.PairPoint();

            Renderer[] renderers = warpPoint.Renderers;
            bool       flag      = false;

            if (!renderers.IsNullOrEmpty <Renderer>())
            {
                foreach (Renderer renderer in renderers)
                {
                    if (renderer.get_isVisible())
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (agent.ChaControl.IsVisibleInCamera)
            {
                ActorCameraControl cameraControl = Singleton <Manager.Map> .Instance.Player.CameraControl;
                if ((double)Vector3.Distance(agent.Position, ((Component)cameraControl).get_transform().get_position()) <= (double)Singleton <Resources> .Instance.LocomotionProfile.CrossFadeEnableDistance)
                {
                    cameraControl.CrossFade.FadeStart(-1f);
                }
            }
            else if (flag)
            {
                Singleton <Manager.Map> .Instance.Player.CameraControl.CrossFade.FadeStart(-1f);
            }
            this.PlayWarpSE(400, ((Component)currentPoint).get_transform());
            this.PlayWarpSE(401, ((Component)warpPoint).get_transform());
            agent.NavMeshWarp(((Component)warpPoint).get_transform(), 0, 100f);
            this.ClearDesire(agent);
            return((TaskStatus)2);
        }
 private void Start()
 {
     this.SearchCanvas();
     if (Object.op_Equality((Object)this._camera, (Object)null))
     {
         this._camera = (ActorCameraControl)((Component)UnityEngine.Camera.get_main())?.GetComponent <ActorCameraControl>();
     }
     ObservableExtensions.Subscribe <long>(Observable.Where <long>(Observable.TakeUntilDestroy <long>((IObservable <M0>)Observable.EveryUpdate(), ((Component)this).get_gameObject()), (Func <M0, bool>)(_ => ((Behaviour)this).get_isActiveAndEnabled())), (Action <M0>)(_ => this.OnUpdate()));
 }
Beispiel #3
0
        private void EndADV()
        {
            Debug.Log((object)"Opening:EndADV");
            AgentActor tutorialAgent = Singleton <Manager.Map> .Instance.TutorialAgent;

            if (Object.op_Inequality((Object)tutorialAgent, (Object)null))
            {
                tutorialAgent.ClearItems();
                ((Component)this._player.CameraControl.CameraComponent).get_transform();
                tutorialAgent.SetLookPtn(0, 3);
                tutorialAgent.SetLookTarget(0, 0, (Transform)null);
            }
            MapUIContainer.SetVisibleHUD(true);
            if (this._player.CameraControl.ShotType == ShotType.PointOfView)
            {
                this._player.CameraControl.XAxisValue = (float)this._player.Rotation.y;
                this._player.CameraControl.YAxisValue = 0.5f;
            }
            else
            {
                ActorCameraControl cameraControl = this._player.CameraControl;
                Quaternion         rotation      = this._player.Rotation;
                double             num           = ((Quaternion) ref rotation).get_eulerAngles().y - 30.0;
                cameraControl.XAxisValue = (float)num;
                this._player.CameraControl.YAxisValue = 0.6f;
            }
            SoundPlayer instance1 = Singleton <SoundPlayer> .Instance;

            instance1.StartAllSubscribe();
            instance1.ActivateWideEnvSE(true);
            this._player.CameraControl.Mode = CameraMode.Normal;
            Manager.Map.SetTutorialProgress(1);
            this._player.PlayerController.ChangeState("Idle");
            this._agent.ChangeTutorialBehavior(AIProject.Definitions.Tutorial.ActionType.HeadToSandBeach);
            MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.InvokeAcception);
            ObservableExtensions.Subscribe <long>(Observable.DelayFrame <long>(Observable.Take <long>(Observable.SkipWhile <long>(Observable.Skip <long>((IObservable <M0>)Observable.EveryUpdate(), 1), (Func <M0, bool>)(_ => this._player.CameraControl.CinemachineBrain.get_IsBlending())), 1), 5, (FrameCountType)0), (System.Action <M0>)(_ =>
            {
                this._player.PlayerController.ChangeState("Normal");
                if (Singleton <MapScene> .IsInstance())
                {
                    MapScene instance2 = Singleton <MapScene> .Instance;
                    instance2.SaveProfile(true);
                    instance2.SaveProfile(false);
                }
                if (!Singleton <Game> .IsInstance())
                {
                    return;
                }
                Singleton <Game> .Instance.SaveGlobalData();
            }));
        }
Beispiel #4
0
 protected override void OnAwake(PlayerActor player)
 {
     this._actorCamera  = player.CameraControl;
     this._camera       = this._actorCamera.CameraComponent;
     this._prevShotType = this._actorCamera.ShotType;
     if (this._prevShotType != ShotType.PointOfView)
     {
         this._actorCamera.ShotType = ShotType.PointOfView;
     }
     this._prevCameraChangeable = this._actorCamera.IsChangeable;
     if (this._prevCameraChangeable)
     {
         this._actorCamera.IsChangeable = false;
     }
     this._prevFieldOfView = (float)this._actorCamera.LensSetting.FieldOfView;
     this._prevDutch       = (float)this._actorCamera.LensSetting.Dutch;
     this._followRoot      = ((CinemachineVirtualCameraBase)this._actorCamera.ActiveFreeLookCamera)?.get_Follow();
     if (Object.op_Inequality((Object)this._followRoot, (Object)null))
     {
         this._prevCameraLocalPosition = this._followRoot.get_localPosition();
         this._prevCameraLocalRotation = this._followRoot.get_localRotation();
     }
     this._cameraLayer = Singleton <Resources> .Instance.DefinePack.MapDefines.MapLayer;
     MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
     MapUIContainer.SetVisibleHUD(false);
     if (Singleton <Resources> .IsInstance())
     {
         LocomotionProfile.LensSettings     defaultLensSetting = Singleton <Resources> .Instance.LocomotionProfile.DefaultLensSetting;
         LocomotionProfile.PhotoShotSetting photoShot          = Singleton <Resources> .Instance.LocomotionProfile.PhotoShot;
         MapUIContainer.PhotoShotUI.SetZoomValue(Mathf.InverseLerp(defaultLensSetting.MinFOV, defaultLensSetting.MaxFOV, this._prevFieldOfView));
     }
     else
     {
         MapUIContainer.PhotoShotUI.SetZoomValue(0.5f);
     }
     MapUIContainer.SetActivePhotoShotUI(true);
     ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (Action <M0>)(_ =>
     {
         this._updatable = false;
         player.PlayerController.ChangeState("Normal");
     }));
     this._updatable = true;
 }
Beispiel #5
0
        private void CrossFade()
        {
            ActorCameraControl actorCameraControl = !Object.op_Inequality((Object)this.Player, (Object)null) ? (ActorCameraControl)null : this.Player.CameraControl;

            if (!Object.op_Inequality((Object)actorCameraControl, (Object)null))
            {
                return;
            }
            bool  flag = false;
            float fadeEnableDistance = Singleton <Resources> .Instance.LocomotionProfile.CrossFadeEnableDistance;
            int   num1     = flag | (double)Vector3.Distance(this.Merchant.Position, ((Component)actorCameraControl).get_transform().get_position()) <= (double)fadeEnableDistance ? 1 : 0;
            bool? nullable = this.CurrentMerchantPoint?.CheckDistance(((Component)actorCameraControl).get_transform().get_position(), fadeEnableDistance);
            int   num2     = !nullable.HasValue ? 0 : (nullable.Value ? 1 : 0);

            if ((num1 | num2) == 0)
            {
                return;
            }
            actorCameraControl.CrossFade.FadeStart(-1f);
        }
Beispiel #6
0
 private void StartMerchantStory0()
 {
     if (!Singleton <Manager.Map> .IsInstance())
     {
         return;
     }
     Manager.Map instance = Singleton <Manager.Map> .Instance;
     this.openData.FindLoad("0", -90, 1);
     this.packData = new CheckEventPointArea.PackData();
     this.packData.Init();
     this.packData.SetParam((IParams)instance.Merchant.MerchantData, (IParams)instance.Player.PlayerData);
     this.packData.onComplete = (System.Action)(() =>
     {
         this.EndMerchantStory0();
         this.packData.Release();
         this.packData = (CheckEventPointArea.PackData)null;
     });
     instance.Player.PlayerController.ChangeState("Idle");
     instance.Merchant.ChangeBehavior(Merchant.ActionType.TalkWithPlayer);
     MapUIContainer.SetVisibleHUD(false);
     ObservableExtensions.Subscribe <Unit>((IObservable <M0>)MapUIContainer.FadeCanvas.StartFade(FadeCanvas.PanelType.Blackout, (global::FadeType)0, 2f, true), (System.Action <M0>)(_ => {}), (System.Action)(() =>
     {
         if (!Singleton <Manager.Map> .IsInstance())
         {
             return;
         }
         MapUIContainer.SetVisibleHUD(false);
         PlayerActor player     = Singleton <Manager.Map> .Instance.Player;
         MerchantActor merchant = Singleton <Manager.Map> .Instance.Merchant;
         StoryPoint storyPoint  = Manager.Map.GetStoryPoint(3);
         Transform transform1   = !Object.op_Inequality((Object)storyPoint, (Object)null) ? (Transform)null : ((Component)storyPoint).get_transform();
         if (Object.op_Inequality((Object)transform1, (Object)null))
         {
             GameObject loop = transform1.FindLoop("player_point");
             if (Object.op_Inequality((Object)loop, (Object)null))
             {
                 transform1 = loop.get_transform();
             }
         }
         if (Object.op_Equality((Object)transform1, (Object)null))
         {
             transform1 = Singleton <Manager.Map> .Instance.PlayerStartPoint;
         }
         Transform transform2 = transform1;
         if (Object.op_Inequality((Object)transform2, (Object)null))
         {
             if (((Behaviour)player.NavMeshAgent).get_enabled())
             {
                 player.NavMeshAgent.Warp(transform2.get_position());
             }
             else
             {
                 player.Position = transform2.get_position();
             }
             player.Rotation = transform2.get_rotation();
         }
         AgentActor tutorialAgent = Singleton <Manager.Map> .Instance.TutorialAgent;
         if (Object.op_Inequality((Object)tutorialAgent, (Object)null))
         {
             if (((Behaviour)tutorialAgent.NavMeshAgent).get_enabled())
             {
                 tutorialAgent.NavMeshAgent.Warp(storyPoint.Position);
             }
             else
             {
                 tutorialAgent.Position = storyPoint.Position;
             }
             tutorialAgent.Rotation = storyPoint.Rotation;
             if (tutorialAgent.TutorialType != AIProject.Definitions.Tutorial.ActionType.WaitAtAgit)
             {
                 tutorialAgent.TargetStoryPoint = storyPoint;
                 tutorialAgent.ChangeTutorialBehavior(AIProject.Definitions.Tutorial.ActionType.WaitAtAgit);
             }
         }
         Transform transform3 = ((Component)merchant.Locomotor).get_transform();
         transform3.LookAt(player.Position);
         Vector3 eulerAngles = transform3.get_eulerAngles();
         eulerAngles.x       = (__Null)(double)(eulerAngles.z = (__Null)0.0f);
         transform3.set_eulerAngles(eulerAngles);
         player.CommCompanion = (Actor)merchant;
         player.PlayerController.ChangeState("Communication");
         if (player.CameraControl.ShotType == ShotType.PointOfView)
         {
             ActorCameraControl cameraControl = player.CameraControl;
             Quaternion rotation = player.Rotation;
             // ISSUE: variable of the null type
             __Null y = ((Quaternion) ref rotation).get_eulerAngles().y;
             cameraControl.XAxisValue        = (float)y;
             player.CameraControl.YAxisValue = 0.5f;
         }
         else
         {
             ActorCameraControl cameraControl = player.CameraControl;
             Quaternion rotation             = player.Rotation;
             double num                      = ((Quaternion) ref rotation).get_eulerAngles().y - 30.0;
             cameraControl.XAxisValue        = (float)num;
             player.CameraControl.YAxisValue = 0.6f;
         }
         // ISSUE: cast to a reference type
         // ISSUE: explicit reference operation
         CinemachineBlendDefinition.Style prevStyle = (CinemachineBlendDefinition.Style)(^ (CinemachineBlendDefinition&)ref player.CameraControl.CinemachineBrain.m_DefaultBlend).m_Style;
         // ISSUE: cast to a reference type
         // ISSUE: explicit reference operation
         (^ (CinemachineBlendDefinition&)ref player.CameraControl.CinemachineBrain.m_DefaultBlend).m_Style = (__Null)0;
         Manager.ADV.ChangeADVCamera((Actor)merchant);
         // ISSUE: cast to a reference type
         // ISSUE: explicit reference operation
         ObservableExtensions.Subscribe <long>(Observable.Take <long>(Observable.Skip <long>((IObservable <M0>)Observable.EveryLateUpdate(), 1), 1), (System.Action <M0>)(_ => (^ (CinemachineBlendDefinition&)ref player.CameraControl.CinemachineBrain.m_DefaultBlend).m_Style = (__Null)prevStyle));
         Transform transform4 = ((Component)player.CameraControl.CameraComponent).get_transform();
         merchant.SetLookPtn(1, 3);
         merchant.SetLookTarget(1, 0, transform4);
         ObservableExtensions.Subscribe <long>(Observable.Take <long>(Observable.SkipWhile <long>(Observable.Skip <long>(Observable.TakeUntilDestroy <long>((IObservable <M0>)Observable.EveryUpdate(), (Component)player), 1), (Func <M0, bool>)(_ => player.CameraControl.CinemachineBrain.get_IsBlending())), 1), (System.Action <M0>)(_ => Singleton <MapUIContainer> .Instance.OpenADV(this.openData, (IPack)this.packData)));
     }));
 }
        public virtual void OnStart()
        {
            ((Task)this).OnStart();
            this._agent = this.Agent;
            this._agent.RuntimeMotivationInPhoto = this._agent.AgentData.StatsTable[5];
            this._prevStateType   = this._agent.StateType;
            this._agent.StateType = AIProject.Definitions.State.Type.Immobility;
            this._poseIDList      = ListPool <int> .Get();

            NavMeshAgent navMeshAgent = this._agent.NavMeshAgent;

            navMeshAgent.set_isStopped(true);
            this._prevPriority = navMeshAgent.get_avoidancePriority();
            navMeshAgent.set_avoidancePriority(Singleton <Resources> .Instance.AgentProfile.AvoidancePriorityStationary);
            this._player          = Singleton <Manager.Map> .Instance.Player;
            this._playerCameraCon = this._player.CameraControl;
            this._prevShotType    = this._playerCameraCon.ShotType;
            this._isFadeOut       = false;
            this._poseStateTable  = (ReadOnlyDictionary <int, ValueTuple <PoseKeyPair, bool> >)null;
            this._poseInfo        = new ValueTuple <PoseKeyPair, bool>(new PoseKeyPair(), false);
            Dictionary <int, ValueTuple <PoseKeyPair, bool> > source;

            if (Singleton <Resources> .Instance.Animation.AgentGravurePoseTable.TryGetValue(this._agent.ChaControl.fileParam.personality, out source) && !source.IsNullOrEmpty <int, ValueTuple <PoseKeyPair, bool> >())
            {
                this._poseStateTable = new ReadOnlyDictionary <int, ValueTuple <PoseKeyPair, bool> >((IDictionary <int, ValueTuple <PoseKeyPair, bool> >)source);
                this._poseIDList.AddRange((IEnumerable <int>) this._poseStateTable.get_Keys());
                this._lastPoseID = this._poseIDList[Random.Range(0, this._poseIDList.Count)];
                this._poseStateTable.TryGetValue(this._lastPoseID, ref this._poseInfo);
            }
            this._poseOutAnimAction = new Subject <Unit>();
            ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>) this._poseOutAnimAction, (Component)this._agent), 1), (System.Action <M0>)(_ =>
            {
                this._isFadeOut = true;
                this.PlayOutAnimation(this._poseInfo);
                this._isWait = (Func <AgentActor, bool>)(actor => actor.Animation.PlayingOutAnimation);
            }));
            this._poseReplayAnimAction = new Subject <Unit>();
            ObservableExtensions.Subscribe <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>) this._poseReplayAnimAction, (Component)this._agent), (System.Action <M0>)(_ =>
            {
                if (this._poseIDList.IsNullOrEmpty <int>())
                {
                    this._poseOutAnimAction.OnNext(Unit.get_Default());
                }
                else
                {
                    if (this._poseIDList.Count == 1)
                    {
                        this._agent.ClearItems();
                        this.PlayInAnimation(this._poseInfo);
                    }
                    else
                    {
                        List <int> toRelease = ListPool <int> .Get();
                        toRelease.AddRange((IEnumerable <int>) this._poseIDList);
                        toRelease.Remove(this._lastPoseID);
                        this._lastPoseID = toRelease[Random.Range(0, toRelease.Count)];
                        ListPool <int> .Release(toRelease);
                        this._poseStateTable.TryGetValue(this._lastPoseID, ref this._poseInfo);
                        this._agent.ClearItems();
                        this.PlayInAnimation(this._poseInfo);
                    }
                    this._isWait      = (Func <AgentActor, bool>)(actor => actor.Animation.PlayingInAnimation);
                    this._onEndAction = (Subject <Unit>)null;
                }
            }));
            this._poseLoopEndAnimAction = new Subject <Unit>();
            ObservableExtensions.Subscribe <Unit>(Observable.TakeUntilDestroy <Unit>((IObservable <M0>) this._poseLoopEndAnimAction, (Component)this._agent), (System.Action <M0>)(_ =>
            {
                this.PlayOutAnimation(this._poseInfo);
                this._isWait      = (Func <AgentActor, bool>)(actor => actor.Animation.PlayingOutAnimation);
                this._onEndAction = this._poseReplayAnimAction;
            }));
            this.PlayInAnimation(this._poseInfo);
            this._isWait      = (Func <AgentActor, bool>)(actor => actor.Animation.PlayingInAnimation);
            this._onEndAction = (Subject <Unit>)null;
        }