Ejemplo n.º 1
0
        protected override void OnAwake(PlayerActor player)
        {
            player.EventKey = AIProject.EventType.Search;
            player.SetActiveOnEquipedItem(false);
            player.ChaControl.setAllLayerWeight(0.0f);
            ValueTuple <int, string> valueTuple;

            AIProject.Definitions.Action.NameTable.TryGetValue(AIProject.EventType.Search, out valueTuple);
            int             index = (int)valueTuple.Item1;
            ActionPointInfo outInfo;

            if (player.CurrentPoint is TutorialSearchActionPoint)
            {
                outInfo = (player.CurrentPoint as TutorialSearchActionPoint).GetPlayerActionPointInfo();
            }
            else
            {
                player.CurrentPoint.TryGetPlayerActionPointInfo(AIProject.EventType.Search, out outInfo);
            }
            int poseId = outInfo.poseID;

            player.PoseID = poseId;
            int        _poseID = poseId;
            Transform  t       = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.baseNullName)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
            GameObject loop    = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullName);

            player.Animation.RecoveryPoint = loop?.get_transform();
            PlayState playState = Singleton <Resources> .Instance.Animation.PlayerActionAnimTable[(int)player.ChaControl.sex][index][_poseID];

            player.Animation.LoadEventKeyTable(index, outInfo.poseID);
            player.LoadEventItems(playState);
            player.LoadEventParticles(index, outInfo.poseID);
            player.Animation.InitializeStates(playState.MainStateInfo.InStateInfo.StateInfos, playState.MainStateInfo.OutStateInfo.StateInfos, playState.MainStateInfo.AssetBundleInfo);
            ActorAnimInfo actorAnimInfo = new ActorAnimInfo()
            {
                layer          = playState.Layer,
                inEnableBlend  = playState.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = playState.MainStateInfo.InStateInfo.FadeSecond,
                inFadeOutTime  = playState.MainStateInfo.FadeOutTime,
                outEnableBlend = playState.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = playState.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = playState.DirectionType,
                endEnableBlend = playState.EndEnableBlend,
                endBlendSec    = playState.EndBlendRate
            };

            player.Animation.AnimInfo = actorAnimInfo;
            ActorAnimInfo animInfo = actorAnimInfo;

            player.DeactivateNavMeshAgent();
            player.IsKinematic = true;
            player.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, animInfo.inFadeOutTime, animInfo.layer);
            ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (System.Action <M0>)(_ => player.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer)));
            player.SetStand(t, animInfo.inEnableBlend, animInfo.inBlendSec, animInfo.directionType);
            player.CameraControl.Mode = CameraMode.ActionFreeLook;
            player.CameraControl.SetShotTypeForce(ShotType.Near);
            player.CameraControl.LoadActionCameraFile(index, _poseID, (Transform)null);
        }
Ejemplo n.º 2
0
        private void SetPlayerAnimationState(PlayerActor _player, int _poseID)
        {
            this.playerPlayState = (PlayState)null;
            Dictionary <int, PoseKeyPair> dictionary;
            PoseKeyPair poseKeyPair;

            if (!Singleton <Resources> .Instance.AnimalTable.PlayerCatchAnimalPoseTable.TryGetValue((int)_player.ChaControl.sex, out dictionary) || !dictionary.TryGetValue(_poseID, out poseKeyPair))
            {
                return;
            }
            PlayState playState = Singleton <Resources> .Instance.Animation.PlayerActionAnimTable[(int)_player.ChaControl.sex][poseKeyPair.postureID][poseKeyPair.poseID];

            _player.Animation.InitializeStates(this.playerPlayState = playState);
            _player.Animation.LoadEventKeyTable(poseKeyPair.postureID, poseKeyPair.poseID);
            _player.LoadEventItems(playState);
        }
Ejemplo n.º 3
0
 protected override void OnAwake(PlayerActor player)
 {
     player.EventKey = (EventType)0;
     player.SetActiveOnEquipedItem(false);
     player.ChaControl.setAllLayerWeight(0.0f);
     if (player.PlayerController.PrevStateName != "Onbu")
     {
         Resources   instance   = Singleton <Resources> .Instance;
         PoseKeyPair menuPoseId = instance.PlayerProfile.PoseIDData.MenuPoseID;
         PlayState   playState  = instance.Animation.PlayerActionAnimTable[(int)player.ChaControl.sex][menuPoseId.postureID][menuPoseId.poseID];
         player.Animation.LoadEventKeyTable(menuPoseId.postureID, menuPoseId.poseID);
         if (player.ChaControl.visibleAll)
         {
             player.LoadEventItems(playState);
             player.LoadEventParticles(menuPoseId.postureID, menuPoseId.poseID);
         }
         player.Animation.InitializeStates(playState);
         ActorAnimInfo actorAnimInfo = new ActorAnimInfo()
         {
             layer          = playState.Layer,
             inEnableBlend  = playState.MainStateInfo.InStateInfo.EnableFade,
             inBlendSec     = playState.MainStateInfo.InStateInfo.FadeSecond,
             outEnableBlend = playState.MainStateInfo.OutStateInfo.EnableFade,
             outBlendSec    = playState.MainStateInfo.OutStateInfo.FadeSecond,
             directionType  = playState.DirectionType,
             isLoop         = playState.MainStateInfo.IsLoop,
             endEnableBlend = playState.EndEnableBlend,
             endBlendSec    = playState.EndBlendRate
         };
         player.Animation.AnimInfo = actorAnimInfo;
         ActorAnimInfo animInfo = actorAnimInfo;
         player.OldEnabledHoldingHand = ((Behaviour)player.HandsHolder).get_enabled();
         if (player.OldEnabledHoldingHand)
         {
             ((Behaviour)player.HandsHolder).set_enabled(false);
             if (player.HandsHolder.EnabledHolding)
             {
                 player.HandsHolder.EnabledHolding = false;
             }
         }
         MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
         player.Animation.StopAllAnimCoroutine();
         player.Animation.PlayInLocoAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, animInfo.layer);
         ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndMenu, 1), (Action <M0>)(_ => player.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer)));
         this._onEndOutAnimDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndOutAnimation, 1), (Action <M0>)(_ =>
         {
             if (this._onEndInputDisposable != null)
             {
                 this._onEndInputDisposable.Dispose();
             }
             this.EndState(player);
         }));
     }
     ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndInAnimation, 1), (Action <M0>)(_ => MapUIContainer.SetActiveSystemMenuUI(true)));
     this._onEndInputDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndInput, 1), (Action <M0>)(_ =>
     {
         if (this._onEndOutAnimDisposable != null)
         {
             this._onEndOutAnimDisposable.Dispose();
         }
         this.EndState(player);
     }));
 }
Ejemplo n.º 4
0
        protected override void OnAwake(PlayerActor player)
        {
            player.EventKey = AIProject.EventType.Break;
            player.SetActiveOnEquipedItem(false);
            player.ChaControl.setAllLayerWeight(0.0f);
            player.CurrentPoint.SetActiveMapItemObjs(false);
            int             index = (int)AIProject.Definitions.Action.NameTable[AIProject.EventType.Break].Item1;
            ActionPointInfo outInfo;

            player.CurrentPoint.TryGetPlayerActionPointInfo(AIProject.EventType.Break, out outInfo);
            int poseId = outInfo.poseID;

            player.PoseID = poseId;
            int        _poseID = poseId;
            Transform  t       = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.baseNullName)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
            GameObject loop    = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullName);

            player.Animation.RecoveryPoint = loop?.get_transform();
            PlayState info = Singleton <Resources> .Instance.Animation.PlayerActionAnimTable[(int)player.ChaControl.sex][index][_poseID];

            player.Animation.LoadEventKeyTable(index, outInfo.poseID);
            player.LoadEventItems(info);
            player.LoadEventParticles(index, outInfo.poseID);
            player.Animation.InitializeStates(info);
            ActorAnimInfo actorAnimInfo1 = new ActorAnimInfo()
            {
                layer          = info.Layer,
                inEnableBlend  = info.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = info.MainStateInfo.InStateInfo.FadeSecond,
                outEnableBlend = info.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = info.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = info.DirectionType,
                isLoop         = info.MainStateInfo.IsLoop,
                endEnableBlend = info.EndEnableBlend,
                endBlendSec    = info.EndBlendRate
            };

            player.Animation.AnimInfo = actorAnimInfo1;
            ActorAnimInfo animInfo = actorAnimInfo1;

            player.DeactivateNavMeshAgent();
            player.IsKinematic = true;
            this._hasAction    = info.ActionInfo.hasAction;
            if (this._hasAction)
            {
                this._loopStateName     = info.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(info.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName;
                this._randomCount       = info.ActionInfo.randomCount;
                this._oldNormalizedTime = 0.0f;
            }
            player.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer);
            ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (System.Action <M0>)(_ => player.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer)));
            ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onElapseTime, 1), (System.Action <M0>)(_ =>
            {
                if (info.SubStateInfos.IsNullOrEmpty <PlayState.PlayStateInfo>())
                {
                    return;
                }
                player.Animation.InStates.Clear();
                PlayState.PlayStateInfo element = info.SubStateInfos.GetElement <PlayState.PlayStateInfo>(Random.Range(0, info.SubStateInfos.Count));
                foreach (PlayState.Info stateInfo in element.InStateInfo.StateInfos)
                {
                    player.Animation.InStates.Enqueue(stateInfo);
                }
                ActorAnimInfo actorAnimInfo2 = new ActorAnimInfo()
                {
                    layer          = info.Layer,
                    inEnableBlend  = element.InStateInfo.EnableFade,
                    inBlendSec     = element.InStateInfo.FadeSecond,
                    outEnableBlend = element.OutStateInfo.EnableFade,
                    outBlendSec    = element.OutStateInfo.FadeSecond,
                    directionType  = info.DirectionType,
                    isLoop         = element.IsLoop
                };
                player.Animation.AnimInfo    = actorAnimInfo2;
                ActorAnimInfo actorAnimInfo3 = actorAnimInfo2;
                player.Animation.AnimABInfo  = info.MainStateInfo.AssetBundleInfo;
                player.Animation.PlayInAnimation(actorAnimInfo3.inEnableBlend, actorAnimInfo3.inBlendSec, element.FadeOutTime, actorAnimInfo3.layer);
            }));
            Transform transform = player.CurrentPoint.SetSlot((Actor)player).Item1;

            player.SetStand(t, animInfo.inEnableBlend, animInfo.inBlendSec, animInfo.directionType);
            player.CameraControl.Mode = CameraMode.ActionFreeLook;
            player.CameraControl.SetShotTypeForce(ShotType.Near);
            player.CameraControl.LoadActionCameraFile(index, _poseID, (Transform)null);
            MapUIContainer.StorySupportUI.Close();
            ObservableExtensions.Subscribe <long>((IObservable <M0>)Observable.Timer(TimeSpan.FromMilliseconds(1000.0)), (System.Action <M0>)(_ =>
            {
                Sprite sprite;
                Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(Singleton <Resources> .Instance.PlayerProfile.CommonActionIconID, out sprite);
                MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.CancelAcception);
                MapUIContainer.CommandLabel.CancelCommand = new CommandLabel.CommandInfo()
                {
                    Text             = "立ち上がる",
                    Icon             = sprite,
                    TargetSpriteInfo = (CommandTargetSpriteInfo)null,
                    Transform        = (Transform)null,
                    Event            = (System.Action)(() =>
                    {
                        MapUIContainer.CommandLabel.CancelCommand = (CommandLabel.CommandInfo)null;
                        MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
                        ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)Observable.FromCoroutine((Func <IEnumerator>)(() => player.Controller.State.End((Actor)player)), false), 1), (System.Action <M0>)(__ =>
                        {
                            player.PlayerController.ChangeState("Normal");
                            player.CameraControl.Mode = CameraMode.Normal;
                            MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.InvokeAcception);
                            MapUIContainer.StorySupportUI.Open();
                        }));
                    })
                };
            }));
        }
Ejemplo n.º 5
0
        protected override void OnAwake(PlayerActor player)
        {
            player.EventKey = AIProject.EventType.Eat;
            player.SetActiveOnEquipedItem(false);
            player.ChaControl.setAllLayerWeight(0.0f);
            MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
            Singleton <Manager.Input> .Instance.ReserveState(Manager.Input.ValidType.UI);

            Singleton <Manager.Input> .Instance.SetupState();

            ObservableExtensions.Subscribe <long>((IObservable <M0>)Observable.Timer(TimeSpan.FromSeconds(1.0)), (System.Action <M0>)(_ =>
            {
                MapUIContainer.RefreshCommands(0, player.DateEatCommandInfos);
                MapUIContainer.SetActiveCommandList(true, "食事");
                MapUIContainer.CommandList.CancelEvent = (System.Action)null;
            }));
            int type = (int)AIProject.Definitions.Action.NameTable[AIProject.EventType.Eat].Item1;
            DateActionPointInfo outInfo;

            player.CurrentPoint.TryGetPlayerDateActionPointInfo(player.ChaControl.sex, AIProject.EventType.Eat, out outInfo);
            AgentActor partner = player.Partner as AgentActor;
            int        poseIda = outInfo.poseIDA;

            player.PoseID = poseIda;
            int index   = poseIda;
            int poseIdb = outInfo.poseIDB;

            partner.PoseID = poseIdb;
            int        poseIDB = poseIdb;
            Transform  t1      = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.baseNullNameA)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
            Transform  t2      = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.baseNullNameB)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
            GameObject loop1   = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullNameA);

            player.Animation.RecoveryPoint = loop1?.get_transform();
            GameObject loop2 = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullNameB);

            player.Partner.Animation.RecoveryPoint = loop2?.get_transform();
            PlayState playState1 = Singleton <Resources> .Instance.Animation.PlayerActionAnimTable[(int)player.ChaControl.sex][type][index];

            player.Animation.LoadEventKeyTable(type, outInfo.poseIDA);
            player.LoadEventItems(playState1);
            player.LoadEventParticles(type, outInfo.poseIDA);
            player.Animation.InitializeStates(playState1);
            partner.Animation.LoadEventKeyTable(type, outInfo.poseIDB);
            PlayState playState2 = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[type][outInfo.poseIDB];

            partner.LoadEventItems(playState2);
            partner.LoadEventParticles(type, outInfo.poseIDB);
            partner.Animation.InitializeStates(playState2);
            ActorAnimInfo actorAnimInfo1 = new ActorAnimInfo()
            {
                layer          = playState1.Layer,
                inEnableBlend  = playState1.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = playState1.MainStateInfo.InStateInfo.FadeSecond,
                outEnableBlend = playState1.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = playState1.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = playState1.DirectionType,
                isLoop         = playState1.MainStateInfo.IsLoop,
                endEnableBlend = playState1.EndEnableBlend,
                endBlendSec    = playState1.EndBlendRate
            };

            player.Animation.AnimInfo = actorAnimInfo1;
            ActorAnimInfo actorAnimInfo2 = actorAnimInfo1;
            ActorAnimInfo actorAnimInfo3 = new ActorAnimInfo()
            {
                layer          = playState2.Layer,
                inEnableBlend  = playState2.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = playState2.MainStateInfo.InStateInfo.FadeSecond,
                outEnableBlend = playState2.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = playState2.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = playState1.DirectionType,
                isLoop         = playState1.MainStateInfo.IsLoop,
                endEnableBlend = playState1.EndEnableBlend,
                endBlendSec    = playState1.EndBlendRate,
                loopMinTime    = playState2.MainStateInfo.LoopMin,
                loopMaxTime    = playState2.MainStateInfo.LoopMax,
                hasAction      = playState2.ActionInfo.hasAction
            };

            partner.Animation.AnimInfo = actorAnimInfo3;
            ActorAnimInfo actorAnimInfo4 = actorAnimInfo3;
            List <int>    intList        = ListPool <int> .Get();

            foreach (KeyValuePair <int, Dictionary <int, int> > foodDateEventItem in Singleton <Resources> .Instance.Map.FoodDateEventItemList)
            {
                foreach (KeyValuePair <int, int> keyValuePair in foodDateEventItem.Value)
                {
                    if (keyValuePair.Value != -1)
                    {
                        intList.Add(keyValuePair.Value);
                    }
                }
            }
            int num = -1;

            if (!intList.IsNullOrEmpty <int>())
            {
                num = intList.GetElement <int>(Random.Range(0, intList.Count));
            }
            ListPool <int> .Release(intList);

            ActionItemInfo eventItemInfo;

            if (Singleton <Resources> .Instance.Map.EventItemList.TryGetValue(num, out eventItemInfo))
            {
                string     rootParentName = Singleton <Resources> .Instance.LocomotionProfile.RootParentName;
                GameObject gameObject1    = player.LoadEventItem(num, rootParentName, false, eventItemInfo);
                if (Object.op_Inequality((Object)gameObject1, (Object)null))
                {
                    foreach (Renderer componentsInChild in (Renderer[])gameObject1.GetComponentsInChildren <Renderer>(true))
                    {
                        componentsInChild.set_enabled(true);
                    }
                }
                GameObject gameObject2 = partner.LoadEventItem(num, rootParentName, false, eventItemInfo);
                if (Object.op_Inequality((Object)gameObject2, (Object)null))
                {
                    foreach (Renderer componentsInChild in (Renderer[])gameObject2.GetComponentsInChildren <Renderer>(true))
                    {
                        componentsInChild.set_enabled(true);
                    }
                }
            }
            player.DeactivateNavMeshAgent();
            player.IsKinematic = true;
            partner.SetActiveOnEquipedItem(false);
            partner.ChaControl.setAllLayerWeight(0.0f);
            partner.DeactivateNavMeshAgent();
            partner.IsKinematic = true;
            this._hasAction     = playState1.ActionInfo.hasAction;
            if (this._hasAction)
            {
                this._loopStateName     = playState1.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(playState1.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName;
                this._randomCount       = playState1.ActionInfo.randomCount;
                this._oldNormalizedTime = 0.0f;
            }
            player.Animation.PlayInAnimation(actorAnimInfo2.inEnableBlend, actorAnimInfo2.inBlendSec, playState1.MainStateInfo.FadeOutTime, actorAnimInfo2.layer);
            player.SetStand(t1, playState1.MainStateInfo.InStateInfo.EnableFade, playState1.MainStateInfo.InStateInfo.FadeSecond, playState1.DirectionType);
            partner.Animation.PlayInAnimation(actorAnimInfo4.inEnableBlend, actorAnimInfo4.inBlendSec, playState2.MainStateInfo.FadeOutTime, actorAnimInfo4.layer);
            partner.SetStand(t2, playState2.MainStateInfo.InStateInfo.EnableFade, playState2.MainStateInfo.InStateInfo.FadeSecond, actorAnimInfo4.layer);
            ObservableExtensions.Subscribe <long>(Observable.Take <long>(Observable.Skip <long>((IObservable <M0>)Observable.EveryLateUpdate(), 1), 1), (System.Action <M0>)(_ => this.ChangeCamera(type, poseIDB, (Actor)partner)));
            player.OldEnabledHoldingHand = ((Behaviour)player.HandsHolder).get_enabled();
            if (!player.OldEnabledHoldingHand)
            {
                return;
            }
            ((Behaviour)player.HandsHolder).set_enabled(false);
            if (!player.HandsHolder.EnabledHolding)
            {
                return;
            }
            player.HandsHolder.EnabledHolding = false;
        }
Ejemplo n.º 6
0
        protected override void OnAwake(PlayerActor player)
        {
            player.EventKey = AIProject.EventType.Search;
            player.SetActiveOnEquipedItem(false);
            player.ChaControl.setAllLayerWeight(0.0f);
            MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
            ValueTuple <int, string> valueTuple;

            AIProject.Definitions.Action.NameTable.TryGetValue(AIProject.EventType.Search, out valueTuple);
            int index = (int)valueTuple.Item1;
            DateActionPointInfo outInfo;

            player.CurrentPoint.TryGetPlayerDateActionPointInfo(player.ChaControl.sex, AIProject.EventType.Search, out outInfo);
            int poseIda = outInfo.poseIDA;

            player.PoseID = poseIda;
            int        _poseID = poseIda;
            Transform  t       = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.baseNullNameA)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
            GameObject loop    = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullNameA);

            player.Animation.RecoveryPoint = loop?.get_transform();
            PlayState playState = Singleton <Resources> .Instance.Animation.PlayerActionAnimTable[(int)player.ChaControl.sex][index][_poseID];

            player.Animation.LoadEventKeyTable(index, outInfo.poseIDA);
            player.LoadEventItems(playState);
            player.LoadEventParticles(index, outInfo.poseIDA);
            player.Animation.InitializeStates(playState);
            ActorAnimInfo actorAnimInfo1 = new ActorAnimInfo()
            {
                layer          = playState.Layer,
                inEnableBlend  = playState.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = playState.MainStateInfo.InStateInfo.FadeSecond,
                outEnableBlend = playState.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = playState.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = playState.DirectionType,
                isLoop         = playState.MainStateInfo.IsLoop,
                endEnableBlend = playState.EndEnableBlend,
                endBlendSec    = playState.EndBlendRate
            };

            player.Partner.Animation.AnimInfo = actorAnimInfo1;
            ActorAnimInfo actorAnimInfo2 = actorAnimInfo1;

            player.Animation.AnimInfo = actorAnimInfo2;
            ActorAnimInfo animInfo = actorAnimInfo2;

            player.SetActiveOnEquipedItem(false);
            player.ChaControl.setAllLayerWeight(0.0f);
            player.DeactivateNavMeshAgent();
            player.IsKinematic = true;
            player.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, playState.MainStateInfo.FadeOutTime, animInfo.layer);
            player.SetStand(t, playState.MainStateInfo.InStateInfo.EnableFade, playState.MainStateInfo.InStateInfo.FadeSecond, playState.DirectionType);
            ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (System.Action <M0>)(_ => player.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer)));
            player.OldEnabledHoldingHand = ((Behaviour)player.HandsHolder).get_enabled();
            if (player.OldEnabledHoldingHand)
            {
                ((Behaviour)player.HandsHolder).set_enabled(false);
                player.HandsHolder.Weight = 0.0f;
                if (player.HandsHolder.EnabledHolding)
                {
                    player.HandsHolder.EnabledHolding = false;
                }
            }
            player.CameraControl.Mode = CameraMode.ActionFreeLook;
            player.CameraControl.SetShotTypeForce(ShotType.Near);
            player.CameraControl.LoadActionCameraFile(index, _poseID, (Transform)null);
        }
Ejemplo n.º 7
0
        protected override void OnAwake(PlayerActor player)
        {
            player.EventKey = AIProject.EventType.Sleep;
            player.SetActiveOnEquipedItem(false);
            player.ChaControl.setAllLayerWeight(0.0f);
            Singleton <Manager.Input> .Instance.ReserveState(Manager.Input.ValidType.UI);

            Singleton <Manager.Input> .Instance.SetupState();

            MapUIContainer.SetVisibleHUDExceptStoryUI(false);
            MapUIContainer.StorySupportUI.Close();
            ObservableExtensions.Subscribe <long>((IObservable <M0>)Observable.Timer(TimeSpan.FromMilliseconds(1000.0)), (System.Action <M0>)(_ => this.OnStart(player)));
            int eventID = (int)AIProject.Definitions.Action.NameTable[AIProject.EventType.Sleep].Item1;
            DateActionPointInfo apInfo;

            player.CurrentPoint.TryGetPlayerDateActionPointInfo(player.ChaControl.sex, AIProject.EventType.Sleep, out apInfo);
            int poseIda = apInfo.poseIDA;

            player.PoseID = poseIda;
            int        index = poseIda;
            Transform  t1    = ((Component)player.CurrentPoint).get_transform().FindLoop(apInfo.baseNullNameA)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
            Transform  t2    = ((Component)player.CurrentPoint).get_transform().FindLoop(apInfo.baseNullNameB)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
            GameObject loop1 = ((Component)player.CurrentPoint).get_transform().FindLoop(apInfo.recoveryNullNameA);

            player.Animation.RecoveryPoint = loop1?.get_transform();
            GameObject     loop2      = ((Component)player.CurrentPoint).get_transform().FindLoop(apInfo.recoveryNullNameB);
            ActorAnimation animation  = player.Partner.Animation;
            Transform      transform1 = loop2?.get_transform();

            player.Partner.Animation.RecoveryPoint = transform1;
            Transform transform2 = transform1;

            animation.RecoveryPoint = transform2;
            PlayState playState1 = Singleton <Resources> .Instance.Animation.PlayerActionAnimTable[(int)player.ChaControl.sex][eventID][index];

            player.Animation.LoadEventKeyTable(eventID, apInfo.poseIDA);
            player.LoadEventItems(playState1);
            player.LoadEventParticles(eventID, apInfo.poseIDA);
            player.Animation.InitializeStates(playState1);
            Actor partner = player.Partner;

            partner.Animation.LoadEventKeyTable(eventID, apInfo.poseIDB);
            PlayState playState2 = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[eventID][apInfo.poseIDB];

            partner.LoadEventItems(playState2);
            partner.LoadEventParticles(eventID, apInfo.poseIDB);
            partner.Animation.InitializeStates(playState2);
            ActorAnimInfo actorAnimInfo1 = new ActorAnimInfo()
            {
                layer          = playState1.Layer,
                inEnableBlend  = playState1.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = playState1.MainStateInfo.InStateInfo.FadeSecond,
                outEnableBlend = playState1.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = playState1.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = playState1.DirectionType,
                isLoop         = playState1.MainStateInfo.IsLoop
            };

            player.Partner.Animation.AnimInfo = actorAnimInfo1;
            ActorAnimInfo actorAnimInfo2 = actorAnimInfo1;

            player.Animation.AnimInfo = actorAnimInfo2;
            ActorAnimInfo actorAnimInfo3 = actorAnimInfo2;
            ActorAnimInfo actorAnimInfo4 = new ActorAnimInfo()
            {
                layer          = playState2.Layer,
                inEnableBlend  = playState2.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = playState2.MainStateInfo.InStateInfo.FadeSecond,
                outEnableBlend = playState2.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = playState2.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = playState2.DirectionType,
                isLoop         = playState2.MainStateInfo.IsLoop,
                loopMinTime    = playState1.MainStateInfo.LoopMin,
                loopMaxTime    = playState1.MainStateInfo.LoopMax,
                hasAction      = playState1.ActionInfo.hasAction
            };

            partner.Animation.AnimInfo = actorAnimInfo4;
            ActorAnimInfo actorAnimInfo5 = actorAnimInfo4;

            player.DeactivateNavMeshAgent();
            player.IsKinematic = true;
            partner.SetActiveOnEquipedItem(false);
            partner.ChaControl.setAllLayerWeight(0.0f);
            partner.DeactivateNavMeshAgent();
            partner.IsKinematic = true;
            this._hasAction     = playState1.ActionInfo.hasAction;
            if (this._hasAction)
            {
                this._loopStateName     = playState1.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(playState1.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName;
                this._randomCount       = playState1.ActionInfo.randomCount;
                this._oldNormalizedTime = 0.0f;
            }
            player.Animation.PlayInAnimation(actorAnimInfo3.inEnableBlend, actorAnimInfo3.inBlendSec, playState1.MainStateInfo.FadeOutTime, actorAnimInfo3.layer);
            player.SetStand(t1, playState1.MainStateInfo.InStateInfo.EnableFade, playState1.MainStateInfo.InStateInfo.FadeSecond, playState1.DirectionType);
            partner.Animation.PlayInAnimation(actorAnimInfo3.inEnableBlend, actorAnimInfo3.inBlendSec, playState2.MainStateInfo.FadeOutTime, actorAnimInfo3.layer);
            partner.SetStand(t2, actorAnimInfo5.inEnableBlend, actorAnimInfo5.inBlendSec, actorAnimInfo3.layer);
            ObservableExtensions.Subscribe <long>(Observable.Take <long>(Observable.Skip <long>((IObservable <M0>)Observable.EveryLateUpdate(), 1), 1), (System.Action <M0>)(_ =>
            {
                if (apInfo.pointID == 501)
                {
                    ADV.ChangeADVFixedAngleCamera((Actor)player, 5);
                }
                else
                {
                    if (apInfo.pointID != 500)
                    {
                        return;
                    }
                    ADV.ChangeADVFixedAngleCamera(partner, 5);
                }
            }));
            bool enabled = ((Behaviour)player.HandsHolder).get_enabled();

            player.OldEnabledHoldingHand = enabled;
            if (enabled)
            {
                ((Behaviour)player.HandsHolder).set_enabled(false);
                if (player.HandsHolder.EnabledHolding)
                {
                    player.HandsHolder.EnabledHolding = false;
                }
            }
            player.CameraControl.SetShotTypeForce(ShotType.Near);
        }
Ejemplo n.º 8
0
        protected override void OnAwake(PlayerActor player)
        {
            player.EventKey = AIProject.EventType.Break;
            player.SetActiveOnEquipedItem(false);
            player.ChaControl.setAllLayerWeight(0.0f);
            int index = (int)AIProject.Definitions.Action.NameTable[AIProject.EventType.Break].Item1;
            DateActionPointInfo outInfo;

            player.CurrentPoint.TryGetPlayerDateActionPointInfo(player.ChaControl.sex, AIProject.EventType.Break, out outInfo);
            int poseIda = outInfo.poseIDA;

            player.PoseID = poseIda;
            int        _poseID   = poseIda;
            Transform  transform = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.baseNullNameA)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
            Transform  t         = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.baseNullNameB)?.get_transform() ?? ((Component)player.CurrentPoint).get_transform();
            GameObject loop1     = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullNameA);

            player.Animation.RecoveryPoint = loop1?.get_transform();
            GameObject loop2 = ((Component)player.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullNameB);

            player.Partner.Animation.RecoveryPoint = loop2?.get_transform();
            PlayState info = Singleton <Resources> .Instance.Animation.PlayerActionAnimTable[(int)player.ChaControl.sex][index][_poseID];

            player.Animation.LoadEventKeyTable(index, outInfo.poseIDA);
            player.LoadEventItems(info);
            player.LoadEventParticles(index, outInfo.poseIDA);
            player.Animation.InitializeStates(info);
            Actor partner = player.Partner;

            partner.Animation.LoadEventKeyTable(index, outInfo.poseIDB);
            PlayState playState = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[index][outInfo.poseIDB];

            partner.LoadEventItems(playState);
            partner.LoadEventParticles(index, outInfo.poseIDB);
            partner.Animation.InitializeStates(playState);
            ActorAnimInfo actorAnimInfo1 = new ActorAnimInfo()
            {
                layer          = info.Layer,
                inEnableBlend  = info.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = info.MainStateInfo.InStateInfo.FadeSecond,
                outEnableBlend = info.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = info.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = info.DirectionType,
                isLoop         = info.MainStateInfo.IsLoop,
                endEnableBlend = info.EndEnableBlend,
                endBlendSec    = info.EndBlendRate
            };

            player.Animation.AnimInfo = actorAnimInfo1;
            ActorAnimInfo actorAnimInfo2 = actorAnimInfo1;
            ActorAnimInfo actorAnimInfo3 = new ActorAnimInfo()
            {
                layer          = playState.Layer,
                inEnableBlend  = playState.MainStateInfo.InStateInfo.EnableFade,
                inBlendSec     = playState.MainStateInfo.InStateInfo.FadeSecond,
                outEnableBlend = playState.MainStateInfo.OutStateInfo.EnableFade,
                outBlendSec    = playState.MainStateInfo.OutStateInfo.FadeSecond,
                directionType  = info.DirectionType,
                isLoop         = info.MainStateInfo.IsLoop,
                loopMinTime    = playState.MainStateInfo.LoopMin,
                loopMaxTime    = playState.MainStateInfo.LoopMax,
                hasAction      = playState.ActionInfo.hasAction
            };

            partner.Animation.AnimInfo = actorAnimInfo3;
            ActorAnimInfo actorAnimInfo4 = actorAnimInfo3;

            player.DeactivateNavMeshAgent();
            player.IsKinematic = true;
            partner.SetActiveOnEquipedItem(false);
            partner.ChaControl.setAllLayerWeight(0.0f);
            partner.DeactivateNavMeshAgent();
            partner.IsKinematic = true;
            this._hasAction     = info.ActionInfo.hasAction;
            if (this._hasAction)
            {
                this._loopStateName     = info.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(info.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName;
                this._randomCount       = info.ActionInfo.randomCount;
                this._oldNormalizedTime = 0.0f;
            }
            ((MonoBehaviour)player).StopAllCoroutines();
            player.Animation.PlayInAnimation(actorAnimInfo2.inEnableBlend, actorAnimInfo2.inBlendSec, info.MainStateInfo.FadeOutTime, actorAnimInfo2.layer);
            player.SetStand(transform, info.MainStateInfo.InStateInfo.EnableFade, info.MainStateInfo.InStateInfo.FadeSecond, info.DirectionType);
            ((MonoBehaviour)partner).StopAllCoroutines();
            partner.Animation.PlayInAnimation(actorAnimInfo4.inEnableBlend, actorAnimInfo4.inBlendSec, playState.MainStateInfo.FadeOutTime, actorAnimInfo4.layer);
            partner.SetStand(t, playState.MainStateInfo.InStateInfo.EnableFade, playState.MainStateInfo.InStateInfo.FadeSecond, actorAnimInfo4.layer);
            ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onElapseTime, 1), (System.Action <M0>)(_ =>
            {
                if (info.SubStateInfos.IsNullOrEmpty <PlayState.PlayStateInfo>())
                {
                    return;
                }
                player.Animation.InStates.Clear();
                foreach (PlayState.Info stateInfo in info.SubStateInfos.GetElement <PlayState.PlayStateInfo>(Random.Range(0, info.SubStateInfos.Count)).InStateInfo.StateInfos)
                {
                    player.Animation.InStates.Enqueue(stateInfo);
                }
            }));
            player.OldEnabledHoldingHand = ((Behaviour)player.HandsHolder).get_enabled();
            if (player.OldEnabledHoldingHand)
            {
                ((Behaviour)player.HandsHolder).set_enabled(false);
                if (player.HandsHolder.EnabledHolding)
                {
                    player.HandsHolder.EnabledHolding = false;
                }
            }
            player.CameraControl.Mode = CameraMode.ActionFreeLook;
            player.CameraControl.SetShotTypeForce(ShotType.Near);
            player.CameraControl.LoadActionCameraFile(index, _poseID, transform);
            Sprite actionIcon;

            Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(Singleton <Resources> .Instance.PlayerProfile.CommonActionIconID, out actionIcon);

            ObservableExtensions.Subscribe <long>((IObservable <M0>)Observable.Timer(TimeSpan.FromSeconds(1.0)), (System.Action <M0>)(_ =>
            {
                MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.CancelAcception);
                MapUIContainer.CommandLabel.CancelCommand = new CommandLabel.CommandInfo()
                {
                    Text             = "立ち上がる",
                    Icon             = actionIcon,
                    TargetSpriteInfo = (CommandTargetSpriteInfo)null,
                    Transform        = (Transform)null,
                    Event            = (System.Action)(() =>
                    {
                        MapUIContainer.CommandLabel.CancelCommand = (CommandLabel.CommandInfo)null;
                        MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
                        ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)Observable.FromCoroutine((Func <IEnumerator>)(() => player.Controller.State.End((Actor)player)), false), 1), (System.Action <M0>)(__ =>
                        {
                            player.PlayerController.ChangeState("Normal");
                            player.CameraControl.Mode = CameraMode.Normal;
                            player.CameraControl.RecoverShotType();
                            MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.InvokeAcception);
                            AgentActor agentPartner = player.AgentPartner;
                            agentPartner.ActivateNavMeshAgent();
                            agentPartner.SetActiveOnEquipedItem(true);
                            ActorAnimInfo animInfo = agentPartner.Animation.AnimInfo;
                            agentPartner.SetStand(agentPartner.Animation.RecoveryPoint, animInfo.endEnableBlend, animInfo.endBlendSec, animInfo.directionType);
                            if (player.OldEnabledHoldingHand)
                            {
                                ((Behaviour)player.HandsHolder).set_enabled(true);
                                player.OldEnabledHoldingHand = false;
                            }
                            agentPartner.BehaviorResources.ChangeMode(Desire.ActionType.Date);
                        }));
                    })
                };
            }));
        }