public virtual void OnStart() { AgentActor agent = this.Agent; agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); agent.HPositionID = agent.HPositionSubID; agent.Animation.StopAllAnimCoroutine(); agent.Animation.InStates.Clear(); if (agent.SurprisePoseID.HasValue) { PoseKeyPair poseKeyPair = agent.SurprisePoseID.Value; PlayState playState = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[poseKeyPair.postureID][poseKeyPair.poseID]; agent.Animation.LoadEventKeyTable(poseKeyPair.postureID, poseKeyPair.poseID); if (!playState.MainStateInfo.InStateInfo.StateInfos.IsNullOrEmpty <PlayState.Info>()) { foreach (PlayState.Info stateInfo in playState.MainStateInfo.InStateInfo.StateInfos) { agent.Animation.InStates.Enqueue(stateInfo); } } } agent.Animation.OutStates.Clear(); agent.MotivationInEncounter = agent.AgentData.StatsTable[5]; List <PlayState.ItemInfo> itemList; if (Singleton <Resources> .Instance.Animation.SurpriseItemList.TryGetValue(((Object)agent.Animation.Animator).get_name(), out itemList)) { agent.LoadEventItems(itemList); } agent.Animation.PlayInLocoAnimation(false, 0.0f, 0); agent.UpdateMotivation = true; }
public virtual void OnStart() { Debug.Log((object)string.Format("開始するEvent = {0}", (object)this._eventID)); ((Task)this).OnStart(); Singleton <MapUIContainer> .Instance.MinimapUI.ChangeCamera(false, false); MapUIContainer.SetVisibleHUD(false); PlayerActor player = Singleton <Manager.Map> .Instance.Player; AgentActor agent = this.Agent; this._prevPartner = agent.CommandPartner; agent.CommandPartner = agent.TargetInSightActor; agent.TargetInSightActor = (Actor)null; agent.ChaControl.ChangeLookEyesTarget(1, ((Component)player.CameraControl.CameraComponent).get_transform(), 0.5f, 0.0f, 1f, 2f); agent.ChaControl.ChangeLookEyesPtn(1); agent.ChaControl.ChangeLookNeckPtn(3, 1f); agent.ChaControl.ChangeLookNeckTarget(0, (Transform)null, 0.5f, 0.0f, 1f, 0.8f); Singleton <Manager.Map> .Instance.Player.CameraControl.OnCameraBlended = (System.Action)(() => ObservableExtensions.Subscribe <long>(Observable.Take <long>(Observable.SkipWhile <long>(Observable.SkipWhile <long>((IObservable <M0>)Observable.EveryUpdate(), (Func <M0, bool>)(_ => agent.Animation.PlayingTurnAnimation)), (Func <M0, bool>)(_ => !Singleton <Manager.ADV> .IsInstance() || Singleton <Manager.ADV> .Instance.Captions.IsProcEndADV)), 1), (System.Action <M0>)(_ => this.OpenADV(player, agent)))); player.CommCompanion = (Actor)agent; player.Controller.ChangeState("Communication"); agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); PoseKeyPair poseKeyPair = Singleton <Resources> .Instance.AgentProfile.ADVIdleTable[agent.ChaControl.fileParam.personality]; PlayState playState = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[poseKeyPair.postureID][poseKeyPair.poseID]; AssetBundleInfo assetBundleInfo = playState.MainStateInfo.AssetBundleInfo; agent.ChangeAnimator((string)assetBundleInfo.assetbundle, (string)assetBundleInfo.asset); agent.Animation.PlayTurnAnimation(player.Position, 1f, playState.MainStateInfo.InStateInfo, false); agent.DisableBehavior(); Manager.ADV.ChangeADVCamera((Actor)agent); MapUIContainer.SetVisibleHUD(false); Singleton <Manager.ADV> .Instance.TargetCharacter = agent; }
public virtual void OnStart() { AgentActor agent = this.Agent; agent.EventKey = EventType.Drink; this._targetItem = agent.SelectDrinkItem(); ((Task)this).OnStart(); agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); PoseKeyPair drinkStandId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.DrinkStandID; agent.ActionID = drinkStandId.postureID; agent.PoseID = drinkStandId.poseID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[drinkStandId.postureID][drinkStandId.poseID]; ActorAnimInfo animInfo = agent.Animation.LoadActionState(drinkStandId.postureID, drinkStandId.poseID, info); agent.LoadActionFlag(drinkStandId.postureID, drinkStandId.poseID); agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer); this._onEndActionDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)agent.AnimationAgent.OnEndActionAsObservable(), 1), (System.Action <M0>)(_ => 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())); if (!animInfo.isLoop) { return; } agent.SetCurrentSchedule(animInfo.isLoop, "その場で飲む", animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); }
public virtual void OnStart() { ((Task)this).OnStart(); AgentActor agent = this.Agent; if (Object.op_Equality((Object)agent.CurrentPoint, (Object)null)) { agent.CurrentPoint = agent.TargetInSightActionPoint; } agent.DeactivateNavMeshAgent(); PoseKeyPair comaId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.ComaID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[comaId.postureID][comaId.poseID]; agent.Animation.LoadEventKeyTable(comaId.postureID, comaId.poseID); agent.Animation.InitializeStates(info); agent.LoadActionFlag(comaId.postureID, comaId.poseID); 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, endEnableBlend = info.EndEnableBlend, endBlendSec = info.EndBlendRate, isLoop = info.MainStateInfo.IsLoop, loopMinTime = info.MainStateInfo.LoopMin, loopMaxTime = info.MainStateInfo.LoopMax, hasAction = info.ActionInfo.hasAction, loopStateName = info.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(info.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName, randomCount = info.ActionInfo.randomCount, oldNormalizedTime = 0.0f }; agent.Animation.AnimInfo = actorAnimInfo1; ActorAnimInfo actorAnimInfo2 = actorAnimInfo1; agent.Animation.PlayInAnimation(actorAnimInfo2.inEnableBlend, actorAnimInfo2.inBlendSec, actorAnimInfo2.inFadeOutTime, actorAnimInfo2.layer); ActionPointInfo outInfo; agent.CurrentPoint.TryGetAgentActionPointInfo(EventType.Sleep, out outInfo); Transform t = ((Component)agent.CurrentPoint).get_transform().FindLoop(outInfo.baseNullName)?.get_transform() ?? ((Component)agent.CurrentPoint).get_transform(); GameObject loop = ((Component)agent.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullName); agent.Animation.RecoveryPoint = loop?.get_transform(); agent.CurrentPoint.SetSlot((Actor)agent); agent.SetStand(t, info.MainStateInfo.InStateInfo.EnableFade, info.MainStateInfo.InStateInfo.FadeSecond, info.DirectionType); agent.SetCurrentSchedule(true, outInfo.actionName, 175, 185, false, false); if (!agent.AgentData.ScheduleEnabled) { return; } 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; }
public virtual void OnStart() { ((Task)this).OnStart(); this.Agent.DeactivateNavMeshAgent(); PoseKeyPair wakeUpId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.WakeUpID; this.PlayAnimation(wakeUpId.postureID, wakeUpId.poseID); }
private PlayState GetPlayState(PoseKeyPair poseKey) { if (!Singleton <Resources> .IsInstance()) { return((PlayState)null); } Dictionary <int, PlayState> dictionary; PlayState playState; return(Singleton <Resources> .Instance.Animation.AgentActionAnimTable.TryGetValue(poseKey.postureID, out dictionary) && dictionary.TryGetValue(poseKey.poseID, out playState) ? playState : (PlayState)null); }
public virtual void OnStart() { ((Task)this).OnStart(); AgentActor agent = this.Agent; agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); PoseKeyPair angryId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.AngryID; this.PlayAnimation(angryId.postureID, angryId.poseID); }
public virtual void OnStart() { AgentActor agent = this.Agent; agent.EventKey = EventType.Play; ((Task)this).OnStart(); agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); PoseKeyPair eatStandId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.EatStandID; agent.ActionID = eatStandId.postureID; agent.PoseID = eatStandId.poseID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[eatStandId.postureID][eatStandId.poseID]; ActorAnimInfo animInfo = agent.Animation.LoadActionState(eatStandId.postureID, eatStandId.poseID, info); StuffItem carryingItem = agent.AgentData.CarryingItem; Dictionary <int, int> dictionary; int num; ActionItemInfo eventItemInfo; if (Singleton <Resources> .Instance.Map.FoodEventItemList.TryGetValue(carryingItem.CategoryID, out dictionary) && dictionary.TryGetValue(carryingItem.ID, out num) && Singleton <Resources> .Instance.Map.EventItemList.TryGetValue(num, out eventItemInfo)) { string rightHandParentName = Singleton <Resources> .Instance.LocomotionProfile.RightHandParentName; GameObject gameObject = agent.LoadEventItem(num, rightHandParentName, false, eventItemInfo); if (Object.op_Inequality((Object)gameObject, (Object)null)) { foreach (Renderer componentsInChild in (Renderer[])gameObject.GetComponentsInChildren <Renderer>(true)) { componentsInChild.set_enabled(true); } } } agent.LoadActionFlag(eatStandId.postureID, eatStandId.poseID); agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer); this._onEndActionDisposable = 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())); if (!animInfo.isLoop) { return; } agent.SetCurrentSchedule(animInfo.isLoop, "その場で食べる", animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); }
public virtual void OnStart() { ((Task)this).OnStart(); PoseKeyPair medicId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.MedicID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[medicId.postureID][medicId.poseID]; this.Agent.Animation.LoadEventKeyTable(medicId.postureID, medicId.poseID); this._layer = info.Layer; this._inEnableFade = info.MainStateInfo.InStateInfo.EnableFade; this._inFadeSecond = info.MainStateInfo.InStateInfo.FadeSecond; this.Agent.Animation.InitializeStates(info); this.Agent.Animation.PlayInAnimation(this._inEnableFade, this._inFadeSecond, info.MainStateInfo.FadeOutTime, this._layer); }
public virtual void OnStart() { AgentActor agent = this.Agent; agent.EventKey = EventType.Play; ((Task)this).OnStart(); agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); List <PoseKeyPair> poseKeyPairList = ListPool <PoseKeyPair> .Get(); AgentProfile.PoseIDCollection poseIdTable = Singleton <Resources> .Instance.AgentProfile.PoseIDTable; poseKeyPairList.AddRange((IEnumerable <PoseKeyPair>)poseIdTable.PlayGameStandIDList); Weather weather = Singleton <Manager.Map> .Instance.Simulator.Weather; if (agent.AreaType == MapArea.AreaType.Normal) { poseKeyPairList.AddRange((IEnumerable <PoseKeyPair>)Singleton <Resources> .Instance.AgentProfile.PoseIDTable.PlayGameStandOutdoorIDList); if (weather == Weather.Cloud1 || weather == Weather.Cloud2) { poseKeyPairList.Add(Singleton <Resources> .Instance.AgentProfile.PoseIDTable.ClearPoseID); } } PoseKeyPair element = poseKeyPairList.GetElement <PoseKeyPair>(Random.Range(0, poseKeyPairList.Count)); ListPool <PoseKeyPair> .Release(poseKeyPairList); agent.ActionID = element.postureID; agent.ActionID = element.poseID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[element.postureID][element.poseID]; agent.Animation.RecoveryPoint = (Transform)null; ActorAnimInfo animInfo = agent.Animation.LoadActionState(element.postureID, element.poseID, info); agent.LoadActionFlag(element.postureID, element.poseID); agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer); this._onEndActionDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)agent.AnimationAgent.OnEndActionAsObservable(), 1), (System.Action <M0>)(_ => 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())); if (!animInfo.isLoop) { return; } agent.SetCurrentSchedule(animInfo.isLoop, "その場で遊ぶ", animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); }
private void StartActionAnimation() { AgentActor agent = this.Agent; PoseKeyPair greetPoseId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.GreetPoseID; PlayState playState = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[greetPoseId.postureID][greetPoseId.poseID]; agent.Animation.LoadEventKeyTable(greetPoseId.postureID, greetPoseId.poseID); this._layer = playState.Layer; this._inEnableFade = playState.MainStateInfo.InStateInfo.EnableFade; this._inFadeTime = playState.MainStateInfo.InStateInfo.FadeSecond; agent.Animation.InitializeStates(playState.MainStateInfo.InStateInfo.StateInfos, playState.MainStateInfo.OutStateInfo.StateInfos, playState.MainStateInfo.AssetBundleInfo); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(this._inEnableFade, this._inFadeTime, 1f, this._layer); }
public virtual void OnStart() { ((Task)this).OnStart(); AgentActor agent = this.Agent; agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); PoseKeyPair ovationId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.OvationID; agent.ActionID = ovationId.postureID; agent.PoseID = ovationId.poseID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[ovationId.postureID][ovationId.poseID]; ActorAnimInfo animInfo = agent.Animation.LoadActionState(ovationId.postureID, ovationId.poseID, info); agent.LoadActionFlag(ovationId.postureID, ovationId.poseID); agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); agent.Animation.StopAllAnimCoroutine(); PlayerActor pPlayer = agent.Partner as PlayerActor; agent.Animation.PlayTurnAnimation(pPlayer.Position, 1f, (PlayState.AnimStateInfo)null, false); this._onEndTurnDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)(this._onEndTurn = new Subject <Unit>()), 1), (Action <M0>)(_ => { if (Object.op_Inequality((Object)pPlayer, (Object)null)) { agent.ChaControl.ChangeLookEyesTarget(1, ((Component)pPlayer.CameraControl.CameraComponent).get_transform(), 0.5f, 0.0f, 1f, 2f); agent.ChaControl.ChangeLookEyesPtn(1); agent.ChaControl.ChangeLookNeckTarget(1, ((Component)pPlayer.CameraControl.CameraComponent).get_transform(), 0.5f, 0.0f, 1f, 0.8f); agent.ChaControl.ChangeLookNeckPtn(1, 1f); } agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer); })); this._onEndActionDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)agent.AnimationAgent.OnEndActionAsObservable(), 1), (Action <M0>)(_ => { agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer); })); this._onCompleteActionDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)agent.AnimationAgent.OnCompleteActionAsObservable(), 1), (Action <M0>)(_ => this.Complete())); if (!animInfo.isLoop) { return; } agent.SetCurrentSchedule(animInfo.isLoop, "拍手", animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); }
public virtual void OnStart() { ((Task)this).OnStart(); AgentActor agent = this.Agent; agent.StateType = AIProject.Definitions.State.Type.Collapse; agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); PoseKeyPair collapseId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.CollapseID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[collapseId.postureID][collapseId.poseID]; agent.Animation.LoadEventKeyTable(collapseId.postureID, collapseId.poseID); this._layer = info.Layer; this._inEnableFade = info.MainStateInfo.InStateInfo.EnableFade; this._inFadeSecond = info.MainStateInfo.InStateInfo.FadeSecond; this.Agent.Animation.InitializeStates(info); this.Agent.Animation.PlayInAnimation(this._inEnableFade, this._inFadeSecond, info.MainStateInfo.FadeOutTime, this._layer); }
public virtual TaskStatus OnUpdate() { AgentActor agent = this.Agent; ActionPoint sightActionPoint = agent.TargetInSightActionPoint; agent.CurrentPoint = sightActionPoint; ActionPoint actionPoint = sightActionPoint; actionPoint.SetSlot((Actor)agent); PoseKeyPair sleepTogetherRight = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.SleepTogetherRight; PoseKeyPair sleepTogetherLeft = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.SleepTogetherLeft; bool flag = false; ActionPointInfo outInfo = new ActionPointInfo(); if (Object.op_Inequality((Object)actionPoint, (Object)null)) { flag = actionPoint.FindAgentActionPointInfo(EventType.Sleep, sleepTogetherRight.poseID, out outInfo) || actionPoint.FindAgentActionPointInfo(EventType.Sleep, sleepTogetherLeft.poseID, out outInfo); } if (!flag) { agent.ChangeBehavior(Desire.ActionType.Normal); return((TaskStatus)1); } Transform t = ((Component)actionPoint).get_transform().FindLoop(outInfo.baseNullName)?.get_transform() ?? ((Component)actionPoint).get_transform(); GameObject loop = ((Component)actionPoint).get_transform().FindLoop(outInfo.recoveryNullName); agent.Animation.RecoveryPoint = loop?.get_transform(); PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[outInfo.eventID][outInfo.poseID]; ActorAnimInfo actorAnimInfo = agent.Animation.LoadActionState(outInfo.eventID, outInfo.poseID, info); agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.DisableActionFlag(); agent.DeactivateNavMeshAgent(); agent.IsKinematic = true; agent.Animation.PlayInAnimation(actorAnimInfo.inEnableBlend, actorAnimInfo.inBlendSec, info.MainStateInfo.FadeOutTime, actorAnimInfo.layer); agent.SetStand(t, info.MainStateInfo.InStateInfo.EnableFade, info.MainStateInfo.InStateInfo.FadeSecond, info.DirectionType); agent.SetCurrentSchedule(actorAnimInfo.isLoop, "添い寝", actorAnimInfo.loopMinTime, actorAnimInfo.loopMaxTime, actorAnimInfo.hasAction, true); agent.ChangeBehavior(Desire.ActionType.EndTaskSleepAfterDate); return((TaskStatus)2); }
private bool TryGetPoseID(int personalID, out PoseKeyPair pair) { Dictionary <int, PoseKeyPair> tutorialIdlePoseTable = Singleton <Resources> .Instance.AgentProfile.TutorialIdlePoseTable; if (tutorialIdlePoseTable.IsNullOrEmpty <int, PoseKeyPair>()) { pair = new PoseKeyPair(); return(false); } if (tutorialIdlePoseTable.TryGetValue(personalID, out pair)) { return(true); } if (tutorialIdlePoseTable.TryGetValue(0, out pair)) { Debug.LogWarning((object)"指定した性格IDでは待機IDが取得できなかったので0番で取得"); return(true); } pair = new PoseKeyPair(); return(false); }
public virtual void OnStart() { ((Task)this).OnStart(); AgentActor agent = this.Agent; if (agent.AgentData.SickState.ID == -1) { return; } agent.StateType = AIProject.Definitions.State.Type.Immobility; agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); PoseKeyPair standHurtId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.StandHurtID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[standHurtId.postureID][standHurtId.poseID]; agent.Animation.LoadEventKeyTable(standHurtId.postureID, standHurtId.poseID); this._layer = info.Layer; this._inEnableFade = info.MainStateInfo.InStateInfo.EnableFade; this._inFadeSecond = info.MainStateInfo.InStateInfo.FadeSecond; agent.Animation.InitializeStates(info); agent.Animation.PlayInAnimation(this._inEnableFade, this._inFadeSecond, info.MainStateInfo.FadeOutTime, this._layer); }
public virtual void OnStart() { ((Task)this).OnStart(); AgentActor agent = this.Agent; agent.StateType = AIProject.Definitions.State.Type.Collapse; agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); PoseKeyPair weaknessId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.WeaknessID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[weaknessId.postureID][weaknessId.poseID]; agent.Animation.LoadEventKeyTable(weaknessId.postureID, weaknessId.poseID); 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, endEnableBlend = info.EndEnableBlend, endBlendSec = info.EndBlendRate, isLoop = info.MainStateInfo.IsLoop, loopMinTime = info.MainStateInfo.LoopMin, loopMaxTime = info.MainStateInfo.LoopMax, hasAction = info.ActionInfo.hasAction, loopStateName = info.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(info.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName, randomCount = info.ActionInfo.randomCount, oldNormalizedTime = 0.0f }; agent.Animation.AnimInfo = actorAnimInfo1; ActorAnimInfo actorAnimInfo2 = actorAnimInfo1; agent.Animation.InitializeStates(info); agent.Animation.PlayInAnimation(actorAnimInfo2.inEnableBlend, actorAnimInfo2.inBlendSec, actorAnimInfo2.inFadeOutTime, actorAnimInfo2.layer); }
public virtual void OnStart() { ((Task)this).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); agent.DeactivateNavMeshAgent(); agent.DisableActionFlag(); 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(); PoseKeyPair wakenUpId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.WakenUpID; PlayState playState = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[wakenUpId.postureID][wakenUpId.poseID]; agent.Animation.LoadEventKeyTable(wakenUpId.postureID, wakenUpId.poseID); ActorAnimInfo actorAnimInfo1 = 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, isLoop = playState.MainStateInfo.IsLoop, loopMinTime = playState.MainStateInfo.LoopMin, loopMaxTime = playState.MainStateInfo.LoopMax, hasAction = playState.ActionInfo.hasAction, loopStateName = playState.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(playState.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName, randomCount = playState.ActionInfo.randomCount, oldNormalizedTime = 0.0f }; agent.Animation.AnimInfo = actorAnimInfo1; ActorAnimInfo actorAnimInfo2 = actorAnimInfo1; if (!playState.MainStateInfo.InStateInfo.StateInfos.IsNullOrEmpty <PlayState.Info>()) { foreach (PlayState.Info stateInfo in playState.MainStateInfo.InStateInfo.StateInfos) { agent.Animation.InStates.Enqueue(stateInfo); } } agent.Animation.OutStates.Clear(); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(actorAnimInfo2.inEnableBlend, actorAnimInfo2.inBlendSec, actorAnimInfo2.inFadeOutTime, actorAnimInfo2.layer); agent.SleepTrigger = false; agent.AgentData.YobaiTrigger = false; agent.CurrentPoint.SetSlot((Actor)agent); agent.SetStand(t, playState.MainStateInfo.InStateInfo.EnableFade, playState.MainStateInfo.InStateInfo.FadeSecond, playState.DirectionType); }
public virtual void OnStart() { AgentActor agent = this.Agent; agent.EventKey = EventType.Cook; Resources instance = Singleton <Resources> .Instance; Dictionary <int, Dictionary <int, Dictionary <int, FoodParameterPacket> > > foodParameterTable = instance.GameInfo.FoodParameterTable; List <StuffItem> itemListInPantry = Singleton <Game> .Instance.Environment.ItemListInPantry; List <StuffItem> stuffItemList = ListPool <StuffItem> .Get(); foreach (StuffItem stuffItem in itemListInPantry) { Dictionary <int, Dictionary <int, FoodParameterPacket> > dictionary; if (foodParameterTable.TryGetValue(stuffItem.CategoryID, out dictionary) && dictionary.TryGetValue(stuffItem.ID, out Dictionary <int, FoodParameterPacket> _)) { this._existsFoods = true; stuffItemList.Add(stuffItem); } } if (!this._existsFoods) { ListPool <StuffItem> .Release(stuffItemList); } else { StuffItem element = stuffItemList.GetElement <StuffItem>(Random.Range(0, stuffItemList.Count)); ListPool <StuffItem> .Release(stuffItemList); if (element == null) { this._existsFoods = false; } else { agent.AgentData.CarryingItem = new StuffItem(element.CategoryID, element.ID, 1); agent.CurrentPoint = agent.TargetInSightActionPoint; agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); agent.CurrentPoint.SetActiveMapItemObjs(false); PoseKeyPair snitchFoodId = instance.AgentProfile.PoseIDTable.SnitchFoodID; agent.ActionID = snitchFoodId.postureID; agent.PoseID = snitchFoodId.poseID; Transform t = ((Component)agent.CurrentPoint).get_transform().FindLoop(instance.DefinePack.MapDefines.StealPivotName)?.get_transform() ?? ((Component)agent.CurrentPoint).get_transform(); agent.Animation.RecoveryPoint = (Transform)null; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[snitchFoodId.postureID][snitchFoodId.poseID]; ActorAnimInfo animInfo = agent.Animation.LoadActionState(snitchFoodId.postureID, snitchFoodId.poseID, info); agent.LoadActionFlag(snitchFoodId.postureID, snitchFoodId.poseID); agent.DeactivateNavMeshAgent(); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer); this._onEndActionDisposable = 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) { return; } agent.SetCurrentSchedule(animInfo.isLoop, "盗み食い", animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); } } }
private static void CreateList( AgentActor agent, List <ActionPoint> source, List <ActionPoint> destination, EventType eventType, bool isFollow) { int searchCount = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount; Dictionary <int, bool> toRelease = DictionaryPool <int, bool> .Get(); foreach (ActionPoint actionPoint1 in source) { if (!Object.op_Equality((Object)actionPoint1, (Object)null) && !Object.op_Equality((Object)actionPoint1.OwnerArea, (Object)null) && (actionPoint1.IsNeutralCommand && !actionPoint1.IsReserved(agent))) { List <ActionPoint> connectedActionPoints = actionPoint1.ConnectedActionPoints; if (!connectedActionPoints.IsNullOrEmpty <ActionPoint>()) { bool flag = false; foreach (ActionPoint actionPoint2 in connectedActionPoints) { if (!Object.op_Equality((Object)actionPoint2, (Object)null) && (!actionPoint2.IsNeutralCommand || actionPoint2.IsReserved(agent))) { flag = true; break; } } if (flag) { continue; } } MapArea ownerArea = actionPoint1.OwnerArea; bool flag1; if (!toRelease.TryGetValue(ownerArea.AreaID, out flag1)) { toRelease[ownerArea.AreaID] = flag1 = Singleton <Manager.Map> .Instance.CheckAvailableMapArea(ownerArea.AreaID); } if (flag1 && (!isFollow ? actionPoint1.AgentEventType : actionPoint1.AgentDateEventType).Contains(eventType)) { switch (eventType) { case EventType.Eat: StuffItem carryingItem = agent.AgentData.CarryingItem; AgentProfile agentProfile = Singleton <Resources> .Instance.AgentProfile; ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems; bool flag2 = false; foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems) { if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID) { flag2 = true; break; } } ActionPointInfo outInfo; if (flag2) { PoseKeyPair eatDeskId1 = agentProfile.PoseIDTable.EatDeskID; PoseKeyPair eatDeskId2 = agentProfile.PoseIDTable.EatDeskID; if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId1.poseID, out outInfo) || actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId2.poseID, out outInfo)) { break; } continue; } PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID; if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out outInfo)) { break; } continue; case EventType.Search: SearchActionPoint searchActionPoint = actionPoint1 as SearchActionPoint; if (Object.op_Inequality((Object)searchActionPoint, (Object)null)) { int registerId = searchActionPoint.RegisterID; Dictionary <int, Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable; Environment.SearchActionInfo searchActionInfo1; if (!searchActionLockTable.TryGetValue(registerId, out searchActionInfo1)) { Environment.SearchActionInfo searchActionInfo2 = new Environment.SearchActionInfo(); searchActionLockTable[registerId] = searchActionInfo2; searchActionInfo1 = searchActionInfo2; } if (searchActionInfo1.Count < searchCount) { int tableId = searchActionPoint.TableID; StuffItem itemInfo = agent.AgentData.EquipedSearchItem(tableId); if (agent.SearchAreaID == 0) { if (tableId != 0 && tableId != 1 && tableId != 2 || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { continue; } break; } if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { continue; } break; } continue; } break; } if (ExistsDesiredActionPoint._navMeshPath == null) { ExistsDesiredActionPoint._navMeshPath = new NavMeshPath(); } if (agent.NavMeshAgent.CalculatePath(actionPoint1.LocatedPosition, ExistsDesiredActionPoint._navMeshPath) && ExistsDesiredActionPoint._navMeshPath.get_status() == null) { destination.Add(actionPoint1); } } } } DictionaryPool <int, bool> .Release(toRelease); }
public virtual void OnStart() { AgentActor agent = this.Agent; agent.EventKey = EventType.Wash; agent.CurrentPoint = agent.TargetInSightActionPoint; agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); Resources instance = Singleton <Resources> .Instance; PoseKeyPair handWash = instance.AgentProfile.PoseIDTable.HandWash; 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(); agent.ActionID = handWash.postureID; agent.PoseID = handWash.poseID; PlayState playState = instance.Animation.AgentActionAnimTable[agent.ActionID][agent.PoseID]; agent.Animation.LoadEventKeyTable(agent.ActionID, agent.PoseID); agent.LoadEventItems(playState); agent.LoadEventParticles(agent.ActionID, agent.PoseID); agent.Animation.InitializeStates(playState); ActorAnimInfo actorAnimInfo = new ActorAnimInfo() { 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, isLoop = playState.MainStateInfo.IsLoop, loopMinTime = playState.MainStateInfo.LoopMin, loopMaxTime = playState.MainStateInfo.LoopMax, hasAction = playState.ActionInfo.hasAction, layer = playState.MainStateInfo.InStateInfo.StateInfos[0].layer }; agent.Animation.AnimInfo = actorAnimInfo; ActorAnimInfo animInfo = actorAnimInfo; agent.LoadActionFlag(agent.ActionID, agent.PoseID); agent.DeactivateNavMeshAgent(); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, playState.MainStateInfo.FadeOutTime, animInfo.layer); this._onEndActionDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)agent.AnimationAgent.OnEndActionAsObservable(), 1), (Action <M0>)(_ => agent.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer))); if (animInfo.hasAction) { this._onActionPlayDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)agent.AnimationAgent.OnActionPlayAsObservable(), (Action <M0>)(_ => agent.Animation.PlayActionAnimation(animInfo.layer))); } this._onCompleteActionDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)agent.AnimationAgent.OnCompleteActionAsObservable(), (Action <M0>)(_ => this.Complete())); agent.CurrentPoint.SetSlot((Actor)agent); agent.SetStand(t, playState.MainStateInfo.InStateInfo.EnableFade, playState.MainStateInfo.InStateInfo.FadeSecond, playState.DirectionType); if (!animInfo.isLoop) { return; } agent.SetCurrentSchedule(animInfo.isLoop, actionPointInfo2.actionName, animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); }
private static bool CheckNeutral( AgentActor agent, ActionPoint pt, Dictionary <int, bool> availableArea, int searchCount, int chunkID, EventType eventType, bool isFollow, bool isRain, float sampleDistance) { if (Object.op_Equality((Object)pt, (Object)null) || Object.op_Equality((Object)pt.OwnerArea, (Object)null) || (!pt.IsNeutralCommand || pt.IsReserved(agent))) { return(false); } List <ActionPoint> connectedActionPoints = pt.ConnectedActionPoints; if (!connectedActionPoints.IsNullOrEmpty <ActionPoint>()) { foreach (ActionPoint actionPoint in connectedActionPoints) { if (!Object.op_Equality((Object)actionPoint, (Object)null) && (!actionPoint.IsNeutralCommand || actionPoint.IsReserved(agent))) { return(false); } } } if (isRain && pt.AreaType != MapArea.AreaType.Indoor) { return(false); } MapArea ownerArea = pt.OwnerArea; if (ownerArea.ChunkID == chunkID) { return(false); } bool flag1; if (!availableArea.TryGetValue(ownerArea.AreaID, out flag1)) { availableArea[ownerArea.AreaID] = flag1 = Singleton <Manager.Map> .Instance.CheckAvailableMapArea(ownerArea.AreaID); } if (!flag1 || !(!isFollow ? pt.AgentEventType : pt.AgentDateEventType).Contains(eventType)) { return(false); } switch (eventType) { case EventType.Eat: StuffItem carryingItem = agent.AgentData.CarryingItem; AgentProfile agentProfile = Singleton <Resources> .Instance.AgentProfile; ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems; bool flag2 = false; foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems) { if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID) { flag2 = true; break; } } if (flag2) { PoseKeyPair eatDeskId1 = agentProfile.PoseIDTable.EatDeskID; PoseKeyPair eatDeskId2 = agentProfile.PoseIDTable.EatDeskID; ActionPointInfo outInfo; if (!pt.FindAgentActionPointInfo(EventType.Eat, eatDeskId1.poseID, out outInfo) && !pt.FindAgentActionPointInfo(EventType.Eat, eatDeskId2.poseID, out outInfo)) { return(false); } break; } PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID; if (!pt.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out ActionPointInfo _)) { return(false); } break; case EventType.Search: SearchActionPoint searchActionPoint = pt as SearchActionPoint; if (Object.op_Inequality((Object)searchActionPoint, (Object)null)) { int registerId = searchActionPoint.RegisterID; Dictionary <int, AIProject.SaveData.Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable; AIProject.SaveData.Environment.SearchActionInfo searchActionInfo1; if (!searchActionLockTable.TryGetValue(registerId, out searchActionInfo1)) { AIProject.SaveData.Environment.SearchActionInfo searchActionInfo2 = new AIProject.SaveData.Environment.SearchActionInfo(); searchActionLockTable[registerId] = searchActionInfo2; searchActionInfo1 = searchActionInfo2; } if (searchActionInfo1.Count >= searchCount) { return(false); } int tableId = searchActionPoint.TableID; StuffItem itemInfo = agent.AgentData.EquipedSearchItem(tableId); if (agent.SearchAreaID == 0) { if (tableId != 0 && tableId != 1 && tableId != 2 || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { return(false); } break; } if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { return(false); } break; } break; case EventType.Warp: WarpPoint warpPoint = pt as WarpPoint; Dictionary <int, List <WarpPoint> > dictionary; List <WarpPoint> warpPointList; if (!Object.op_Inequality((Object)warpPoint, (Object)null) || !Singleton <Manager.Map> .Instance.WarpPointDic.TryGetValue(ownerArea.ChunkID, out dictionary) || (!dictionary.TryGetValue(warpPoint.TableID, out warpPointList) || warpPointList.Count < 2)) { return(false); } break; } if (SetDesiredActionOtherChunk._navMeshPath == null) { SetDesiredActionOtherChunk._navMeshPath = new NavMeshPath(); } NavMeshHit navMeshHit; return(agent.NavMeshAgent.CalculatePath(pt.LocatedPosition, SetDesiredActionOtherChunk._navMeshPath) && SetDesiredActionOtherChunk._navMeshPath.get_status() == null && NavMesh.SamplePosition(pt.LocatedPosition, ref navMeshHit, sampleDistance, agent.NavMeshAgent.get_areaMask())); }
public virtual TaskStatus OnUpdate() { AgentActor agent = this.Agent; Dictionary <int, CollisionState> collisionStateTable = agent.ActionPointCollisionStateTable; List <ActionPoint> toRelease = ListPool <ActionPoint> .Get(); foreach (ActionPoint searchTarget in agent.SearchTargets) { CollisionState collisionState; if (collisionStateTable.TryGetValue(searchTarget.InstanceID, out collisionState) && collisionState == CollisionState.Enter) { toRelease.Add(searchTarget); } } if (toRelease.Count > 0) { List <ActionPoint> actionPointList = ListPool <ActionPoint> .Get(); foreach (ActionPoint actionPoint in toRelease) { if (actionPoint.IsNeutralCommand) { actionPointList.Add(actionPoint); } } Desire.Type requestedDesire = agent.RequestedDesire; EventType type = (EventType)0; foreach (ValueTuple <EventType, Desire.Type> valuePair in Desire.ValuePairs) { if ((Desire.Type)valuePair.Item2 == requestedDesire) { type = (EventType)valuePair.Item1; break; } } ActionPoint point = (ActionPoint)null; foreach (ActionPoint actionPoint in actionPointList) { if (Object.op_Inequality((Object)agent.Partner, (Object)null)) { if (actionPoint.AgentDateEventType.Contains(type)) { point = actionPoint; } } else if (actionPoint.AgentEventType.Contains(type)) { point = actionPoint; } } if (Object.op_Equality((Object)point, (Object)null)) { point = actionPointList.GetElement <ActionPoint>(Random.Range(0, actionPointList.Count)); if (Object.op_Equality((Object)point, (Object)null)) { ListPool <ActionPoint> .Release(actionPointList); ListPool <ActionPoint> .Release(toRelease); return((TaskStatus)1); } } ListPool <ActionPoint> .Release(actionPointList); if (Debug.get_isDebugBuild()) { if (Object.op_Inequality((Object)agent.Partner, (Object)null)) { Debug.Log((object)string.Format("{0} :: Enter Point In Sight: {1} <{2}>", (object)((Object)((Component)agent).get_gameObject()).get_name(), (object)((Object)point).get_name(), (object)point.AgentDateEventType)); } else { Debug.Log((object)string.Format("{0} :: Enter Point In Sight: {1} <{2}>", (object)((Object)((Component)agent).get_gameObject()).get_name(), (object)((Object)point).get_name(), (object)point.AgentEventType)); } } if (requestedDesire == Desire.Type.Bath && type == EventType.DressIn && (double)agent.ChaControl.fileGameInfo.flavorState[2] < (double)Singleton <Resources> .Instance.StatusProfile.CanDressBorder) { type = EventType.Bath; } if (type == EventType.Eat) { StuffItem carryingItem = agent.AgentData.CarryingItem; AgentProfile agentProfile = Singleton <Resources> .Instance.AgentProfile; ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems; bool flag = false; foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems) { if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID) { flag = true; break; } } if (flag) { PoseKeyPair eatDeskId = agentProfile.PoseIDTable.EatDeskID; PoseKeyPair eatChairId = agentProfile.PoseIDTable.EatChairID; ActionPointInfo outInfo; if (!point.FindAgentActionPointInfo(EventType.Eat, eatDeskId.poseID, out outInfo) && !point.FindAgentActionPointInfo(EventType.Eat, eatChairId.poseID, out outInfo)) { return((TaskStatus)1); } } else { PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID; if (!point.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out ActionPointInfo _)) { return((TaskStatus)1); } } } switch (agent.AgentController.GetPermission(point)) { case AgentController.PermissionStatus.Prohibition: Debug.Log((object)string.Format("目的地落選: {0}", (object)((Object)point).get_name())); break; case AgentController.PermissionStatus.Permission: Debug.Log((object)string.Format("目的地当選: {0}", (object)((Object)point).get_name())); if (type == (EventType)0) { Debug.LogError((object)string.Format("EventType該当なし: {0}", (object)requestedDesire)); } agent.EventKey = type; agent.TargetInSightActionPoint = point; agent.RuntimeDesire = agent.RequestedDesire; break; } } ListPool <ActionPoint> .Release(toRelease); if (!Object.op_Inequality((Object)agent.TargetInSightActionPoint, (Object)null)) { return((TaskStatus)1); } agent.ClearReservedNearActionWaypoints(); agent.AbortActionPatrol(); return((TaskStatus)2); }
protected override void OnCompletedStateTask() { AgentActor agent = this.Agent; int desireKey = Desire.GetDesireKey(Desire.Type.Game); agent.SetDesire(desireKey, 0.0f); PoseKeyPair wateringId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.WateringID; if (agent.ActionID != wateringId.postureID || agent.PoseID != wateringId.poseID) { return; } float? nullable = new float?(); FarmPoint farmPoint1 = (FarmPoint)null; foreach (FarmPoint farmPoint2 in Singleton <Manager.Map> .Instance.PointAgent.FarmPoints) { float num = Vector3.Distance(agent.Position, farmPoint2.Position); if (nullable.HasValue) { if ((double)num < (double)nullable.Value) { nullable = new float?(num); farmPoint1 = farmPoint2; } } else { nullable = new float?(num); farmPoint1 = farmPoint2; } } foreach (KeyValuePair <int, FarmPoint> keyValuePair in (IEnumerable <KeyValuePair <int, FarmPoint> >)Singleton <Manager.Map> .Instance.PointAgent.RuntimeFarmPointTable) { if (keyValuePair.Value.Kind == FarmPoint.FarmKind.Plant) { float num = Vector3.Distance(agent.Position, keyValuePair.Value.Position); if (nullable.HasValue) { if ((double)num < (double)nullable.Value) { nullable = new float?(num); farmPoint1 = keyValuePair.Value; } } else { nullable = new float?(num); farmPoint1 = keyValuePair.Value; } } } List <AIProject.SaveData.Environment.PlantInfo> plantInfoList; if (!Object.op_Inequality((Object)farmPoint1, (Object)null) || !Singleton <Game> .Instance.Environment.FarmlandTable.TryGetValue(farmPoint1.RegisterID, out plantInfoList)) { return; } foreach (AIProject.SaveData.Environment.PlantInfo plantInfo in plantInfoList) { plantInfo?.AddTimer(60f); } if (!agent.ChaControl.fileGameInfo.normalSkill.ContainsValue(12)) { return; } foreach (AIProject.SaveData.Environment.PlantInfo plantInfo in plantInfoList) { plantInfo?.AddTimer(20f); } }
public virtual void OnStart() { ((Task)this).OnStart(); AgentActor agent = this.Agent; agent.ElectNextPoint(); this._poseInfo = new PoseKeyPair?(); if (Random.Range(0, 2) == 0 || agent.PrevMode == Desire.ActionType.Encounter) { return; } agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); AgentProfile agentProfile = Singleton <Resources> .Instance.AgentProfile; float num1 = agent.AgentData.StatsTable[0]; float num2 = agent.AgentData.StatsTable[2]; int desireKey1 = Desire.GetDesireKey(Desire.Type.Bath); float? desire1 = agent.GetDesire(desireKey1); int desireKey2 = Desire.GetDesireKey(Desire.Type.Sleep); float? desire2 = agent.GetDesire(desireKey2); if (agent.AgentData.SickState.ID == 0) { this._poseInfo = new PoseKeyPair?(agentProfile.PoseIDTable.CoughID); } else if ((!desire2.HasValue ? 0 : ((double)desire2.GetValueOrDefault() >= 70.0 ? 1 : 0)) != 0) { this._poseInfo = new PoseKeyPair?(agentProfile.PoseIDTable.YawnID); } else if ((!desire1.HasValue ? 0 : ((double)desire1.GetValueOrDefault() >= 70.0 ? 1 : 0)) != 0) { this._poseInfo = new PoseKeyPair?(agentProfile.PoseIDTable.GrossID); } else if ((double)num1 <= (double)agentProfile.ColdTempBorder) { this._poseInfo = new PoseKeyPair?(agentProfile.PoseIDTable.ColdPoseID); } else if ((double)num1 >= (double)agentProfile.HotTempBorder) { this._poseInfo = new PoseKeyPair?(agentProfile.PoseIDTable.HotPoseID); } else if ((double)num2 <= 0.0) { this._poseInfo = new PoseKeyPair?(agentProfile.PoseIDTable.HungryID); } if (!this._poseInfo.HasValue) { return; } PoseKeyPair poseKeyPair = this._poseInfo.Value; agent.ActionID = poseKeyPair.postureID; agent.PoseID = poseKeyPair.poseID; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[poseKeyPair.postureID][poseKeyPair.poseID]; ActorAnimInfo animInfo = agent.Animation.LoadActionState(poseKeyPair.postureID, poseKeyPair.poseID, info); agent.LoadActionFlag(poseKeyPair.postureID, poseKeyPair.poseID); agent.DeactivateNavMeshAgent(); agent.Animation.RecoveryPoint = (Transform)null; agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, animInfo.layer); this._onEndActionDisposable = 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>)(_ => this.Agent.Animation.PlayActionAnimation(animInfo.layer))); } this._onCompleteActionDisposable = ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)agent.AnimationAgent.OnCompleteActionAsObservable(), 1), (System.Action <M0>)(_ => this.Complete())); if (!animInfo.isLoop) { return; } agent.SetCurrentSchedule(animInfo.isLoop, "立ちアクション", animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); }
private static void CreateList( AgentActor agent, List <ActionPoint> source, List <ActionPoint> destination, EventType eventType, bool isFollow, bool isRain) { int searchCount = Singleton <Manager.Map> .Instance.EnvironmentProfile.SearchCount; float meshSampleDistance = Singleton <Resources> .Instance.LocomotionProfile.ActionPointNavMeshSampleDistance; foreach (ActionPoint actionPoint1 in source) { if (!Object.op_Equality((Object)actionPoint1, (Object)null) && !Object.op_Equality((Object)actionPoint1.OwnerArea, (Object)null) && (actionPoint1.IsNeutralCommand && !actionPoint1.IsReserved(agent))) { List <ActionPoint> connectedActionPoints = actionPoint1.ConnectedActionPoints; if (!connectedActionPoints.IsNullOrEmpty <ActionPoint>()) { bool flag = false; foreach (ActionPoint actionPoint2 in connectedActionPoints) { if (!Object.op_Equality((Object)actionPoint2, (Object)null) && (!actionPoint2.IsNeutralCommand || actionPoint2.IsReserved(agent))) { flag = true; break; } } if (flag) { continue; } } if ((!isRain || actionPoint1.AreaType == MapArea.AreaType.Indoor) && (!isFollow ? actionPoint1.AgentEventType : actionPoint1.AgentDateEventType).Contains(eventType)) { switch (eventType) { case EventType.Eat: StuffItem carryingItem = agent.AgentData.CarryingItem; AgentProfile agentProfile = Singleton <Resources> .Instance.AgentProfile; ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems; bool flag = false; foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems) { if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID) { flag = true; break; } } ActionPointInfo outInfo; if (flag) { PoseKeyPair eatDeskId1 = agentProfile.PoseIDTable.EatDeskID; PoseKeyPair eatDeskId2 = agentProfile.PoseIDTable.EatDeskID; if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId1.poseID, out outInfo) || actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDeskId2.poseID, out outInfo)) { break; } continue; } PoseKeyPair eatDishId = agentProfile.PoseIDTable.EatDishID; if (actionPoint1.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out outInfo)) { break; } continue; case EventType.Search: SearchActionPoint searchActionPoint = actionPoint1 as SearchActionPoint; if (Object.op_Inequality((Object)searchActionPoint, (Object)null)) { int registerId = searchActionPoint.RegisterID; Dictionary <int, AIProject.SaveData.Environment.SearchActionInfo> searchActionLockTable = agent.AgentData.SearchActionLockTable; AIProject.SaveData.Environment.SearchActionInfo searchActionInfo1; if (!searchActionLockTable.TryGetValue(registerId, out searchActionInfo1)) { AIProject.SaveData.Environment.SearchActionInfo searchActionInfo2 = new AIProject.SaveData.Environment.SearchActionInfo(); searchActionLockTable[registerId] = searchActionInfo2; searchActionInfo1 = searchActionInfo2; } if (searchActionInfo1.Count < searchCount) { int tableId = searchActionPoint.TableID; StuffItem itemInfo = agent.AgentData.EquipedSearchItem(tableId); if (agent.SearchAreaID == 0) { if (tableId != 0 && tableId != 1 && tableId != 2 || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { continue; } break; } if (agent.SearchAreaID != searchActionPoint.TableID || !searchActionPoint.CanSearch(EventType.Search, itemInfo)) { continue; } break; } continue; } break; case EventType.Warp: WarpPoint warpPoint = actionPoint1 as WarpPoint; Dictionary <int, List <WarpPoint> > dictionary; List <WarpPoint> warpPointList; if (!Object.op_Inequality((Object)warpPoint, (Object)null) || !Singleton <Manager.Map> .Instance.WarpPointDic.TryGetValue(warpPoint.OwnerArea.ChunkID, out dictionary) || (!dictionary.TryGetValue(warpPoint.TableID, out warpPointList) || warpPointList.Count < 2)) { continue; } break; } if (SetDesiredActionOtherChange._navMeshPath == null) { SetDesiredActionOtherChange._navMeshPath = new NavMeshPath(); } NavMeshHit navMeshHit; if (agent.NavMeshAgent.CalculatePath(actionPoint1.LocatedPosition, SetDesiredActionOtherChange._navMeshPath) && SetDesiredActionOtherChange._navMeshPath.get_status() == null && NavMesh.SamplePosition(actionPoint1.LocatedPosition, ref navMeshHit, meshSampleDistance, agent.NavMeshAgent.get_areaMask())) { destination.Add(actionPoint1); } } } } }
public virtual void OnStart() { AgentActor agent = this.Agent; agent.EventKey = EventType.Eat; agent.CurrentPoint = agent.TargetInSightActionPoint; agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); agent.CurrentPoint.SetActiveMapItemObjs(false); StuffItem carryingItem = agent.AgentData.CarryingItem; ItemIDKeyPair[] canStandEatItems = Singleton <Resources> .Instance.AgentProfile.CanStandEatItems; bool flag = false; foreach (ItemIDKeyPair itemIdKeyPair in canStandEatItems) { if (carryingItem.CategoryID == itemIdKeyPair.categoryID && carryingItem.ID == itemIdKeyPair.itemID) { flag = true; break; } } ActionPointInfo outInfo; if (flag) { PoseKeyPair eatDeskId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.EatDeskID; PoseKeyPair eatChairId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.EatChairID; if (agent.TargetInSightActionPoint.FindAgentActionPointInfo(EventType.Eat, eatDeskId.poseID, out outInfo)) { agent.Animation.ActionPointInfo = outInfo; } else if (agent.TargetInSightActionPoint.FindAgentActionPointInfo(EventType.Eat, eatChairId.poseID, out outInfo)) { agent.Animation.ActionPointInfo = outInfo; } } else { PoseKeyPair eatDishId = Singleton <Resources> .Instance.AgentProfile.PoseIDTable.EatDishID; if (agent.TargetInSightActionPoint.FindAgentActionPointInfo(EventType.Eat, eatDishId.poseID, out outInfo)) { agent.Animation.ActionPointInfo = outInfo; } } Transform t = ((Component)agent.CurrentPoint).get_transform().FindLoop(outInfo.baseNullName)?.get_transform() ?? ((Component)agent.CurrentPoint).get_transform(); GameObject loop = ((Component)agent.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullName); agent.Animation.RecoveryPoint = loop?.get_transform(); int eventId = outInfo.eventID; agent.ActionID = eventId; int index = eventId; int poseId = outInfo.poseID; agent.PoseID = poseId; int poseID = poseId; PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[index][poseID]; ActorAnimInfo animInfo = agent.Animation.LoadActionState(index, poseID, info); Dictionary <int, int> dictionary; int num; ActionItemInfo eventItemInfo; if (Singleton <Resources> .Instance.Map.FoodEventItemList.TryGetValue(carryingItem.CategoryID, out dictionary) && dictionary.TryGetValue(carryingItem.ID, out num) && Singleton <Resources> .Instance.Map.EventItemList.TryGetValue(num, out eventItemInfo)) { LocomotionProfile locomotionProfile = Singleton <Resources> .Instance.LocomotionProfile; string parentName = !flag ? locomotionProfile.RootParentName : locomotionProfile.RightHandParentName; GameObject gameObject = agent.LoadEventItem(num, parentName, false, eventItemInfo); if (Object.op_Inequality((Object)gameObject, (Object)null)) { foreach (Renderer componentsInChild in (Renderer[])gameObject.GetComponentsInChildren <Renderer>(true)) { componentsInChild.set_enabled(true); } } } agent.LoadActionFlag(index, poseID); agent.DeactivateNavMeshAgent(); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, info.MainStateInfo.FadeOutTime, 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) { return; } agent.SetCurrentSchedule(animInfo.isLoop, outInfo.actionName, animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, true); }
public virtual void OnStart() { ((Task)this).OnStart(); this.Agent.StopNavMeshAgent(); this.Agent.AnimalFovAngleOffsetY = 0.0f; int id = this.Agent.AgentData.SickState.ID; PlayState playState1 = new PlayState(); Dictionary <int, Dictionary <int, PlayState> > agentActionAnimTable = Singleton <Resources> .Instance.Animation.AgentActionAnimTable; AgentProfile.PoseIDCollection poseIdTable = Singleton <Resources> .Instance.AgentProfile.PoseIDTable; this.isSick = -1 < id; this.isCold = false; PlayState playState2; if (this.isSick) { if (id == 0) { this.isCold = true; PoseKeyPair coughId = poseIdTable.CoughID; playState2 = agentActionAnimTable[coughId.postureID][coughId.poseID]; } else { PoseKeyPair[] normalIdList = poseIdTable.NormalIDList; PoseKeyPair element = normalIdList.GetElement <PoseKeyPair>(Random.Range(0, normalIdList.Length)); playState2 = agentActionAnimTable[element.postureID][element.poseID]; } } else { List <PoseKeyPair> poseKeyPairList = ListPool <PoseKeyPair> .Get(); poseKeyPairList.AddRange((IEnumerable <PoseKeyPair>)poseIdTable.NormalIDList); switch (Singleton <Manager.Map> .Instance.Simulator.Weather) { case Weather.Clear: case Weather.Cloud1: poseKeyPairList.Add(poseIdTable.ClearPoseID); break; } PoseKeyPair element = poseKeyPairList.GetElement <PoseKeyPair>(Random.Range(0, poseKeyPairList.Count)); ListPool <PoseKeyPair> .Release(poseKeyPairList); playState2 = agentActionAnimTable[element.postureID][element.poseID]; } this.layer = playState2.Layer; this.inEnableFade = playState2.MainStateInfo.InStateInfo.EnableFade; this.inFadeTime = playState2.MainStateInfo.InStateInfo.FadeSecond; this.Agent.Animation.OnceActionStates.Clear(); if (!playState2.MainStateInfo.InStateInfo.StateInfos.IsNullOrEmpty <PlayState.Info>()) { foreach (PlayState.Info stateInfo in playState2.MainStateInfo.InStateInfo.StateInfos) { this.Agent.Animation.OnceActionStates.Add(stateInfo); } } this.Agent.Animation.OutStates.Clear(); if (!playState2.MainStateInfo.OutStateInfo.StateInfos.IsNullOrEmpty <PlayState.Info>()) { foreach (PlayState.Info stateInfo in playState2.MainStateInfo.OutStateInfo.StateInfos) { this.Agent.Animation.OutStates.Enqueue(stateInfo); } } this.duration = Singleton <Resources> .Instance.AgentProfile.StandDurationMinMax.RandomValue; this.onEndEvent = new Subject <Unit>(); ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this.onEndEvent, 1), (Action <M0>)(_ => this.Agent.Animation.PlayOutAnimation(this.outEnableFade, this.outFadeTime, this.layer))); this.onStartEvent = (Action)(() => this.Agent.Animation.PlayOnceActionAnimation(this.inEnableFade, this.inFadeTime, this.layer)); }