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 override void OnStart() { AgentActor agent = this.Agent; agent.EventKey = EventType.DoorOpen; OffMeshLinkData currentOffMeshLinkData = agent.NavMeshAgent.get_currentOffMeshLinkData(); DoorPoint component1 = (DoorPoint)((Component)((OffMeshLinkData) ref currentOffMeshLinkData).get_offMeshLink()).GetComponent <DoorPoint>(); agent.TargetInSightActionPoint = (ActionPoint)component1; this._actionMotion = new PoseKeyPair() { postureID = -1, poseID = -1 }; base.OnStart(); if (!Object.op_Inequality((Object)agent.CurrentPoint, (Object)null)) { return; } DoorAnimation component2 = (DoorAnimation)((Component)agent.CurrentPoint).GetComponent <DoorAnimation>(); if (!Object.op_Inequality((Object)component2, (Object)null)) { return; } ActionPointInfo actionPointInfo = agent.Animation.ActionPointInfo; PlayState playState = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[actionPointInfo.eventID][actionPointInfo.poseID]; component2.Load(playState.MainStateInfo.InStateInfo.StateInfos); ActorAnimInfo animInfo = agent.Animation.AnimInfo; component2.PlayAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, playState.MainStateInfo.FadeOutTime, animInfo.layer); }
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(); AgentActor agent = this.Agent; agent.CurrentPoint = agent.TargetInSightActionPoint; agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); if (Object.op_Equality((Object)agent.CurrentPoint, (Object)null)) { return; } 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); ValueTuple <int, string> valueTuple; if (AIProject.Definitions.Action.NameTable.TryGetValue(agent.EventKey, out valueTuple) && (int)valueTuple.Item1 != agent.ActionID) { return; } ActorAnimInfo animInfo = agent.Animation.LoadActionState(index, poseID, info); agent.LoadActionFlag(index, 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.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, actionPointInfo2.actionName, animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); }
public TaskStatus OnUpdateActionState() { if (this.PlayingInAnimation) { return((TaskStatus)3); } ActorAnimInfo animInfo = this.AnimInfo; if (animInfo.isLoop) { if (this.PlayingActAnimation) { return((TaskStatus)3); } if (!(this.Actor as AgentActor).Schedule.enabled) { if (this._endAction != null) { this._endAction.OnNext(Unit.get_Default()); } if (this.PlayingOutAnimation) { return((TaskStatus)3); } if (this._completeAction != null) { this._completeAction.OnNext(Unit.get_Default()); } return((TaskStatus)2); } AnimatorStateInfo animatorStateInfo = this.Animator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo) ref animatorStateInfo).IsName(animInfo.loopStateName) && (double)(((AnimatorStateInfo) ref animatorStateInfo).get_normalizedTime() - animInfo.oldNormalizedTime) > 1.0) { animInfo.oldNormalizedTime = ((AnimatorStateInfo) ref animatorStateInfo).get_normalizedTime(); if (Random.Range(0, animInfo.randomCount) == 0) { if (this._actionPlay != null) { this._actionPlay.OnNext(Unit.get_Default()); } animInfo.oldNormalizedTime = 0.0f; } } return((TaskStatus)3); } if (this._endAction != null) { this._endAction.OnNext(Unit.get_Default()); } if (this.PlayingOutAnimation) { return((TaskStatus)3); } if (this._completeAction != null) { this._completeAction.OnNext(Unit.get_Default()); } return((TaskStatus)2); }
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() { 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 Complete() { AgentActor agent = this.Agent; AgentActor partner = agent.Partner as AgentActor; ActorAnimInfo animInfo1 = agent.Animation.AnimInfo; if (!animInfo1.outEnableBlend) { agent.Animation.CrossFadeScreen(-1f); } agent.SetStand(agent.Animation.RecoveryPoint, animInfo1.endEnableBlend, animInfo1.endBlendSec, animInfo1.directionType); agent.Animation.RefsActAnimInfo = true; partner.SetStand(partner.Animation.RecoveryPoint, animInfo1.endEnableBlend, animInfo1.endBlendSec, animInfo1.directionType); partner.Animation.RefsActAnimInfo = true; agent.UpdateStatus(agent.ActionID, agent.PoseID); partner.UpdateStatus(partner.ActionID, partner.PoseID); agent.CauseSick(); agent.ApplySituationResultParameter(28); partner.ApplySituationResultParameter(28); int desireKey1 = Desire.GetDesireKey(Desire.Type.Game); agent.SetDesire(desireKey1, 0.0f); partner.SetDesire(desireKey1, 0.0f); int desireKey2 = Desire.GetDesireKey(Desire.Type.Lonely); agent.SetDesire(desireKey2, 0.0f); partner.SetDesire(desireKey2, 0.0f); agent.ClearItems(); agent.ClearParticles(); agent.ResetActionFlag(); partner.ResetActionFlag(); agent.SetDefaultStateHousingItem(); agent.CurrentPoint.SetActiveMapItemObjs(true); agent.Partner = (Actor)null; partner.Partner = (Actor)null; partner.ActivateNavMeshAgent(); partner.SetActiveOnEquipedItem(true); ActorAnimInfo animInfo2 = partner.Animation.AnimInfo; partner.BehaviorResources.ChangeMode(Desire.ActionType.Normal); partner.Mode = Desire.ActionType.Normal; agent.TargetInSightActor = (Actor)null; agent.CurrentPoint.ReleaseSlot((Actor)this.Agent); agent.CurrentPoint = (ActionPoint)null; agent.EventKey = (EventType)0; agent.PrevActionPoint = this.Agent.TargetInSightActionPoint; agent.TargetInSightActionPoint = (ActionPoint)null; }
public virtual void OnStart() { ((Task)this).OnStart(); this._agent = this.Agent; this._animation = this._agent.Animation; this._agent.DeactivateNavMeshAgent(); if (this._notNeet = Object.op_Equality((Object)this._animation, (Object)null)) { return; } this._loopStateName = string.Empty; PoseKeyPair pair; if (!Singleton <Resources> .IsInstance() || !this.TryGetPoseID(this._agent.ChaControl.fileParam.personality, out pair)) { return; } PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[pair.postureID][pair.poseID]; this._loopStateName = info.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(info.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName; AnimatorStateInfo animatorStateInfo = this._animation.Animator.GetCurrentAnimatorStateInfo(0); if (this._notNeet = ((AnimatorStateInfo) ref animatorStateInfo).IsName(this._loopStateName)) { return; } this._animation.InitializeStates(info); this._animation.LoadEventKeyTable(pair.postureID, pair.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, isLoop = info.MainStateInfo.IsLoop }; this._animation.AnimInfo = actorAnimInfo1; ActorAnimInfo actorAnimInfo2 = actorAnimInfo1; this._animation.StopAllAnimCoroutine(); this._animation.PlayInAnimation(actorAnimInfo2.inEnableBlend, actorAnimInfo2.inBlendSec, actorAnimInfo2.inFadeOutTime, actorAnimInfo2.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 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); }
protected void PlayAnimation(int postureID, int poseID) { AgentActor agent = this.Agent; agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); PlayState playState = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[postureID][poseID]; agent.Animation.LoadEventKeyTable(postureID, poseID); 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, 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 = actorAnimInfo; ActorAnimInfo animInfo = actorAnimInfo; agent.Animation.InitializeStates(playState.MainStateInfo.InStateInfo.StateInfos, playState.MainStateInfo.OutStateInfo.StateInfos, playState.MainStateInfo.AssetBundleInfo); this._onEndAction = new Subject <Unit>(); ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (Action <M0>)(_ => { agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer); })); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, animInfo.inFadeOutTime, animInfo.layer); }
private void PlayIdleAnimation() { PoseKeyPair pair; if (!Singleton <Resources> .IsInstance() || !this.TryGetPoseID(this._agent.ChaControl.fileParam.personality, out pair)) { return; } PlayState info = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[pair.postureID][pair.poseID]; this._loopStateName = info.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(info.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName; AnimatorStateInfo animatorStateInfo = this._agent.Animation.Animator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo) ref animatorStateInfo).IsName(this._loopStateName)) { return; } this._animation.InitializeStates(info); this._animation.LoadEventKeyTable(pair.postureID, pair.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, isLoop = info.MainStateInfo.IsLoop, endEnableBlend = info.EndEnableBlend, endBlendSec = info.EndBlendRate }; this._animation.AnimInfo = actorAnimInfo1; ActorAnimInfo actorAnimInfo2 = actorAnimInfo1; this._animation.StopAllAnimCoroutine(); this._animation.PlayInAnimation(actorAnimInfo2.inEnableBlend, actorAnimInfo2.inBlendSec, actorAnimInfo2.inFadeOutTime, actorAnimInfo2.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 override void OnStart() { this._unchangeParamState = true; AgentActor agent = this.Agent; this._prevEventKey = agent.EventKey; agent.EventKey = EventType.DoorOpen; OffMeshLinkData currentOffMeshLinkData = agent.NavMeshAgent.get_currentOffMeshLinkData(); DoorPoint component1 = (DoorPoint)((Component)((OffMeshLinkData) ref currentOffMeshLinkData).get_offMeshLink()).GetComponent <DoorPoint>(); this._prevTargetPoint = agent.TargetInSightActionPoint; this._isDoorOpen = !((OffMeshLinkData) ref currentOffMeshLinkData).get_activated() || Object.op_Equality((Object)component1, (Object)null) || component1.IsOpen; if (this._isDoorOpen) { agent.EventKey = this._prevEventKey; } else { agent.TargetInSightActionPoint = (ActionPoint)component1; base.OnStart(); if (!Object.op_Inequality((Object)agent.CurrentPoint, (Object)null)) { return; } DoorAnimation component2 = (DoorAnimation)((Component)agent.CurrentPoint).GetComponent <DoorAnimation>(); if (!Object.op_Inequality((Object)component2, (Object)null)) { return; } ActionPointInfo actionPointInfo = agent.Animation.ActionPointInfo; PlayState playState = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[actionPointInfo.eventID][actionPointInfo.poseID]; component2.Load(playState.MainStateInfo.InStateInfo.StateInfos); ActorAnimInfo animInfo = agent.Animation.AnimInfo; component2.PlayAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, playState.MainStateInfo.FadeOutTime, animInfo.layer); } }
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); }
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); } } }
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); }
public virtual void OnStart() { AgentActor agent = this.Agent; agent.EventKey = EventType.Play; agent.CurrentPoint = agent.TargetInSightActionPoint; agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); agent.CurrentPoint.SetActiveMapItemObjs(false); DateActionPointInfo outInfo; agent.CurrentPoint.TryGetAgentDateActionPointInfo(EventType.Play, out outInfo); Transform t1 = ((Component)agent.CurrentPoint).get_transform().FindLoop(outInfo.baseNullNameA)?.get_transform() ?? ((Component)agent.CurrentPoint).get_transform(); Transform t2 = ((Component)agent.CurrentPoint).get_transform().FindLoop(outInfo.baseNullNameB)?.get_transform() ?? ((Component)agent.CurrentPoint).get_transform(); GameObject loop1 = ((Component)agent.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullNameA); agent.Animation.RecoveryPoint = loop1?.get_transform(); GameObject loop2 = ((Component)agent.CurrentPoint).get_transform().FindLoop(outInfo.recoveryNullNameB); agent.Animation.RecoveryPoint = loop2?.get_transform(); int eventId = outInfo.eventID; agent.ActionID = eventId; int eventID = eventId; int poseIda = outInfo.poseIDA; agent.PoseID = poseIda; int poseID1 = poseIda; PlayState playState1 = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[eventID][poseID1]; agent.Animation.LoadEventKeyTable(eventID, poseID1); agent.LoadEventItems(playState1); agent.LoadEventParticles(eventID, poseID1); agent.Animation.InitializeStates(playState1); AgentActor partner = agent.Partner as AgentActor; partner.BehaviorResources.ChangeMode(Desire.ActionType.Idle); partner.Mode = Desire.ActionType.Idle; partner.ActionID = eventID; int poseIdb = outInfo.poseIDB; partner.PoseID = poseIdb; int poseID2 = poseIdb; partner.Animation.LoadEventKeyTable(eventID, poseID2); PlayState playState2 = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[eventID][poseID2]; partner.LoadEventItems(playState2); partner.LoadEventParticles(eventID, poseID2); partner.Animation.InitializeStates(playState2); ActorAnimInfo actorAnimInfo1 = new ActorAnimInfo() { inEnableBlend = playState1.MainStateInfo.InStateInfo.EnableFade, inBlendSec = playState1.MainStateInfo.InStateInfo.FadeSecond, inFadeOutTime = playState1.MainStateInfo.FadeOutTime, outEnableBlend = playState1.MainStateInfo.OutStateInfo.EnableFade, outBlendSec = playState1.MainStateInfo.OutStateInfo.FadeSecond, directionType = playState1.DirectionType, endEnableBlend = playState1.EndEnableBlend, endBlendSec = playState1.EndBlendRate, isLoop = playState1.MainStateInfo.IsLoop, loopMinTime = playState1.MainStateInfo.LoopMin, loopMaxTime = playState1.MainStateInfo.LoopMax, hasAction = playState1.ActionInfo.hasAction, loopStateName = playState1.MainStateInfo.InStateInfo.StateInfos.GetElement <PlayState.Info>(playState1.MainStateInfo.InStateInfo.StateInfos.Length - 1).stateName, randomCount = playState1.ActionInfo.randomCount, oldNormalizedTime = 0.0f, layer = playState1.MainStateInfo.InStateInfo.StateInfos[0].layer }; agent.Animation.AnimInfo = actorAnimInfo1; ActorAnimInfo animInfo = actorAnimInfo1; ActorAnimInfo actorAnimInfo2 = 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 }; partner.Animation.AnimInfo = actorAnimInfo2; ActorAnimInfo actorAnimInfo3 = actorAnimInfo2; agent.DisableActionFlag(); partner.DisableActionFlag(); agent.DeactivateNavMeshAgent(); agent.IsKinematic = true; partner.SetActiveOnEquipedItem(false); partner.ChaControl.setAllLayerWeight(0.0f); partner.DeactivateNavMeshAgent(); partner.IsKinematic = true; agent.CurrentPoint.SetSlot((Actor)agent); agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, playState1.MainStateInfo.FadeOutTime, animInfo.layer); agent.SetStand(t1, playState1.MainStateInfo.InStateInfo.EnableFade, playState1.MainStateInfo.InStateInfo.FadeSecond, animInfo.layer); partner.Animation.PlayInAnimation(actorAnimInfo3.inEnableBlend, actorAnimInfo3.inBlendSec, playState2.MainStateInfo.FadeOutTime, actorAnimInfo3.layer); partner.SetStand(t2, playState2.MainStateInfo.InStateInfo.EnableFade, playState2.MainStateInfo.InStateInfo.FadeSecond, actorAnimInfo3.layer); ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (System.Action <M0>)(_ => { agent.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer); partner.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer); })); if (animInfo.hasAction) { ObservableExtensions.Subscribe <Unit>((IObservable <M0>) this._onActionPlay, (System.Action <M0>)(_ => { agent.Animation.PlayActionAnimation(animInfo.layer); partner.Animation.PlayActionAnimation(animInfo.layer); })); } if (!animInfo.isLoop) { return; } agent.SetCurrentSchedule(animInfo.isLoop, outInfo.actionName, animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); }
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.StorageIn; agent.CurrentPoint = agent.TargetInSightActionPoint; agent.SetActiveOnEquipedItem(false); agent.ChaControl.setAllLayerWeight(0.0f); agent.ElectNextPoint(); ValueTuple <int, string> valueTuple; AIProject.Definitions.Action.NameTable.TryGetValue(agent.EventKey, out valueTuple); agent.ActionID = (int)valueTuple.Item1; 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.PoseID = actionPointInfo2.poseID; PlayState playState = Singleton <Resources> .Instance.Animation.AgentActionAnimTable[agent.ActionID][actionPointInfo2.poseID]; agent.Animation.LoadEventKeyTable(agent.ActionID, actionPointInfo2.poseID); agent.LoadEventItems(playState); agent.LoadEventParticles(agent.ActionID, actionPointInfo2.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; Resources instance = Singleton <Resources> .Instance; agent.LoadActionFlag(actionPointInfo2.eventID, actionPointInfo2.poseID); agent.DeactivateNavMeshAgent(); ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onStartChestAction, 1), (System.Action <M0>)(_ => { if (!Object.op_Inequality((Object)this._chestAnimation, (Object)null)) { return; } this._chestAnimation.PlayInAnimation(); })); ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onStartAction, 1), (System.Action <M0>)(_ => agent.Animation.PlayInAnimation(animInfo.inEnableBlend, animInfo.inBlendSec, animInfo.inFadeOutTime, animInfo.layer))); ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (System.Action <M0>)(_ => { agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayOutAnimation(animInfo.outEnableBlend, animInfo.outBlendSec, animInfo.layer); })); if (animInfo.hasAction) { ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onActionPlay, 1), (System.Action <M0>)(_ => agent.Animation.PlayActionAnimation(animInfo.layer))); } agent.CurrentPoint.SetSlot((Actor)agent); agent.SetStand(t, playState.MainStateInfo.InStateInfo.EnableFade, playState.MainStateInfo.InStateInfo.FadeSecond, playState.DirectionType); if (animInfo.isLoop) { this.Agent.SetCurrentSchedule(animInfo.isLoop, (string)valueTuple.Item2, animInfo.loopMinTime, animInfo.loopMaxTime, animInfo.hasAction, false); } if (!Object.op_Inequality((Object)this.Agent.CurrentPoint, (Object)null)) { return; } this._chestAnimation = (ChestAnimation)((Component)this.Agent.CurrentPoint).GetComponent <ChestAnimation>(); }
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() { 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); }