Ejemplo n.º 1
0
        public virtual void OnStart()
        {
            AgentActor agent = this.Agent;

            agent.EventKey     = EventType.Sleep;
            agent.CurrentPoint = agent.TargetInSightActionPoint;
            agent.SetActiveOnEquipedItem(false);
            agent.ChaControl.setAllLayerWeight(0.0f);
            agent.ElectNextPoint();
            agent.CurrentPoint.SetActiveMapItemObjs(false);
            ActionPointInfo actionPointInfo1 = agent.TargetInSightActionPoint.GetActionPointInfo(agent);

            agent.Animation.ActionPointInfo = actionPointInfo1;
            ActionPointInfo actionPointInfo2 = actionPointInfo1;
            Transform       t    = ((Component)agent.CurrentPoint).get_transform().FindLoop(actionPointInfo2.baseNullName)?.get_transform() ?? ((Component)agent.CurrentPoint).get_transform();
            GameObject      loop = ((Component)agent.CurrentPoint).get_transform().FindLoop(actionPointInfo2.recoveryNullName);

            agent.Animation.RecoveryPoint = loop?.get_transform();
            int eventId = actionPointInfo2.eventID;

            agent.ActionID = eventId;
            int index  = eventId;
            int poseId = actionPointInfo2.poseID;

            agent.PoseID = poseId;
            int       poseID = poseId;
            PlayState info   = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[index][poseID];

            agent.CurrentPoint.DestroyByproduct(index, poseID);
            ActorAnimInfo animInfo = agent.Animation.LoadActionState(index, poseID, info);

            agent.LoadActionFlag(index, poseID);
            agent.DeactivateNavMeshAgent();
            agent.Animation.StopAllAnimCoroutine();
            agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, animInfo.inFadeOutTime, animInfo.layer);
            this._onActionPlayDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)agent.AnimationAgent.OnEndActionAsObservable(), 1), (System.Action <M0>)(_ =>
            {
                agent.Animation.StopAllAnimCoroutine();
                agent.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer);
            }));
            if (animInfo.hasAction)
            {
                this._onActionPlayDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)agent.AnimationAgent.OnActionPlayAsObservable(), (System.Action <M0>)(_ => agent.Animation.PlayActionAnimation(animInfo.layer)));
            }
            this._onCompleteActionDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)agent.AnimationAgent.OnCompleteActionAsObservable(), (System.Action <M0>)(_ => this.Complete()));
            agent.CurrentPoint.SetSlot((Actor)agent);
            agent.SetStand(t, info.MainStateInfo.InStateInfo.EnableFade, info.MainStateInfo.InStateInfo.FadeSecond, info.DirectionType);
            if (animInfo.isLoop)
            {
                agent.SetCurrentSchedule(animInfo.isLoop, actionPointInfo2.actionName, 100, 200, animInfo.hasAction, true);
                if (agent.AgentData.ScheduleEnabled)
                {
                    Actor.BehaviorSchedule schedule = agent.Schedule;
                    schedule.enabled                = agent.AgentData.ScheduleEnabled;
                    schedule.elapsedTime            = agent.AgentData.ScheduleElapsedTime;
                    schedule.duration               = agent.AgentData.ScheduleDuration;
                    agent.Schedule                  = schedule;
                    agent.AgentData.ScheduleEnabled = false;
                }
            }
            MapUIContainer.AddSystemLog(string.Format("{0}が寝ました", (object)MapUIContainer.CharaNameColor((Actor)agent)), true);
        }
Ejemplo n.º 2
0
        protected override void Start()
        {
            if (Object.op_Equality((Object)this._commandBasePoint, (Object)null))
            {
                this._commandBasePoint = ((Component)this).get_transform().FindLoop(Singleton <Resources> .Instance.DefinePack.MapDefines.CommandTargetName)?.get_transform() ?? ((Component)this).get_transform();
            }
            if (Object.op_Equality((Object)this._warpPoint, (Object)null))
            {
                this._warpPoint = ((Component)this).get_transform().FindLoop(Singleton <Resources> .Instance.DefinePack.MapDefines.BasePointWarpTargetName)?.get_transform() ?? ((Component)this).get_transform();
            }
            if (Object.op_Equality((Object)this._housingCenter, (Object)null))
            {
                this._housingCenter = ((Component)this).get_transform().FindLoop(Singleton <Resources> .Instance.DefinePack.MapDefines.HousingCenterTargetName)?.get_transform() ?? ((Component)this).get_transform();
            }
            if (this._recoverPoints.IsNullOrEmpty <Transform>() || this._recoverPoints.Count < 4)
            {
                this._recoverPoints.Clear();
                foreach (string recoveryTargetName in Singleton <Resources> .Instance.DefinePack.MapDefines.DevicePointRecoveryTargetNames)
                {
                    GameObject loop = ((Component)this).get_transform().FindLoop(recoveryTargetName);
                    if (Object.op_Inequality((Object)loop, (Object)null))
                    {
                        this._recoverPoints.Add(loop.get_transform());
                    }
                }
            }
            Singleton <Manager.Map> .Instance.HousingRecoveryPointTable[this._id] = this._recoverPoints;
            if (this._isHousing)
            {
                Singleton <Manager.Map> .Instance.HousingPointTable[this._id] = this._housingCenter;
            }
            if (Singleton <Game> .Instance.WorldData.Cleared && this._id >= 3)
            {
                Singleton <Manager.Map> .Instance.SetBaseOpenState(this._id, true);
            }
            base.Start();
            if (!this._isHousing)
            {
                return;
            }
            CommonDefine.CommonIconGroup icon       = Singleton <Resources> .Instance.CommonDefine.Icon;
            DefinePack.MapGroup          mapDefines = Singleton <Resources> .Instance.DefinePack.MapDefines;
            Sprite sprite;

            Singleton <Resources> .Instance.itemIconTables.ActionIconTable.TryGetValue(Singleton <Resources> .Instance.CommonDefine.Icon.BaseIconID, out sprite);

            Transform transform = ((Component)this).get_transform().FindLoop(mapDefines.BasePointLabelTargetName)?.get_transform() ?? ((Component)this).get_transform();

            this._labels = new CommandLabel.CommandInfo[1]
            {
                new CommandLabel.CommandInfo()
                {
                    Text             = "拠点",
                    Icon             = sprite,
                    IsHold           = true,
                    TargetSpriteInfo = icon.ActionSpriteInfo,
                    Transform        = transform,
                    Condition        = (Func <PlayerActor, bool>)null,
                    Event            = (Action)(() =>
                    {
                        if (Singleton <Manager.Map> .Instance.SetBaseOpenState(this._id, true))
                        {
                            string str;
                            if (Singleton <Resources> .Instance.itemIconTables.BaseName.TryGetValue(this._id, out str))
                            {
                                MapUIContainer.AddSystemLog(string.Format("{0} に移動できるようになりました。", (object)str), true);
                            }
                            else
                            {
                                MapUIContainer.AddSystemLog(string.Format("拠点{0}に移動できるようになりました。", (object)this._id), true);
                            }
                        }
                        if (Manager.Map.GetTutorialProgress() == 10)
                        {
                            Manager.Map.SetTutorialProgress(11);
                        }
                        MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
                        Singleton <Manager.Map> .Instance.HousingID = this._id;
                        Singleton <Manager.Map> .Instance.HousingAreaID = this._areaIDInHousing;
                        Singleton <Manager.Map> .Instance.Player.Controller.ChangeState("BaseMenu");
                    })
                }
            };
        }