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); }
private static void ChangeBehavior(ref Desire.ActionType type, AgentActor __instance) { if (type == Desire.ActionType.SearchH && __instance.CanMasturbation && Random.Range(0, 100) < Rate.Value) { type = Desire.ActionType.SearchMasturbation; } }
private static void GetAddRate(ref float __result, int key, AgentActor __instance) { if (key == Desire.GetDesireKey(Desire.Type.Game) && InteractionRate.Value != 0) { __result = InteractionRate.Value; } }
private static ActionPoint RandomDestination( AgentActor agent, EventType eventType, List <ActionPoint> sourceList, List <ActionPoint> list, bool isFollow, bool isRain, out bool changeWarp) { changeWarp = false; if (eventType == EventType.Play && !isFollow) { List <ActionPoint> actionPointList = ListPool <ActionPoint> .Get(); SetDesiredRandomAction.CreateList(agent, sourceList, actionPointList, EventType.Warp, false, isRain); if (list.IsNullOrEmpty <ActionPoint>() && actionPointList.IsNullOrEmpty <ActionPoint>()) { return((ActionPoint)null); } int index = Random.Range(0, list.Count + actionPointList.Count); ListPool <ActionPoint> .Release(actionPointList); changeWarp = index >= list.Count; return(!changeWarp?list.GetElement <ActionPoint>(index) : (ActionPoint)null); } return(list.IsNullOrEmpty <ActionPoint>() ? (ActionPoint)null : list.GetElement <ActionPoint>(Random.Range(0, list.Count))); }
// Updates the behaviour public override BehaviourResult UpdateBehaviour(AgentActor agent) { Vector3 agentPos = agent.gameObject.transform.position; //distanceDetection = agent.maxSpeed / 2f; //Debug.Log("agent Pos: " + agentPos); if ((agentPos - m_waypoints[m_currentWaypointNumber]).sqrMagnitude <= distanceDetection && m_currentWaypointNumber < m_waypoints.Count - 1) { m_currentWaypointNumber++; m_currentTarget = m_waypoints[m_currentWaypointNumber]; //Debug.Log("Current Target: " + m_waypoints[m_currentWaypointNumber]); } else if (m_currentWaypointNumber >= m_waypoints.Count - 1) { if (m_castle != null) { m_castle.castleTouched = false; } m_currentWaypointNumber = 0; return(BehaviourResult.FAILURE); } m_seekForce.SetTarget(m_waypoints[m_currentWaypointNumber]); agent.AddForce(m_seekForce.GetForce(agent)); return(BehaviourResult.SUCCESS); }
private void StartADV() { Debug.Log((object)"Opening:StartADV"); if (Object.op_Equality((Object)this._player, (Object)null)) { return; } AgentActor tutorialAgent = Singleton <Manager.Map> .Instance.TutorialAgent; this._player.CommCompanion = (Actor)tutorialAgent; this._player.PlayerController.ChangeState("Communication"); if (!Object.op_Inequality((Object)tutorialAgent, (Object)null)) { return; } Transform transform = ((Component)this._player.CameraControl.CameraComponent).get_transform(); tutorialAgent.SetLookPtn(1, 3); tutorialAgent.SetLookTarget(1, 0, transform); this.openData.FindLoad("0", tutorialAgent.AgentData.param.charaID, 100); this.packData = new OpeningWakeUp.PackData(); this.packData.Init(); this.packData.SetParam((IParams)tutorialAgent.AgentData, (IParams)this._player.PlayerData); this.packData.onComplete = (System.Action)(() => { this.EndADV(); this.packData.Release(); this.packData = (OpeningWakeUp.PackData)null; }); ObservableExtensions.Subscribe <long>(Observable.DelayFrame <long>(Observable.Take <long>(Observable.SkipWhile <long>(Observable.Skip <long>((IObservable <M0>)Observable.EveryUpdate(), 1), (Func <M0, bool>)(_ => this._player.CameraControl.CinemachineBrain.get_IsBlending())), 1), 5, (FrameCountType)0), (System.Action <M0>)(_ => Singleton <MapUIContainer> .Instance.OpenADV(this.openData, (IPack)this.packData))); }
public virtual void OnStart() { AgentActor agent = this.Agent; if (agent.EquipedItem != null) { return; } ((Task)this).OnStart(); agent.StateType = AIProject.Definitions.State.Type.Greet; agent.StopNavMeshAgent(); agent.ChangeStaticNavMeshAgentAvoidance(); this.StartActionAnimation(); ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEnd, 1), (System.Action <M0>)(_ => { agent.Animation.StopAllAnimCoroutine(); agent.Animation.PlayOutAnimation(this._outEnableFade, this._outFadeTime, this._layer); })); Quaternion rotation = this.Agent.Rotation; Vector3 vector3 = Vector3.op_Subtraction(this.Agent.TargetInSightActor.Position, this.Agent.Position); vector3.y = (__Null)0.0; Quaternion forwardRotation = Quaternion.LookRotation(Vector3.Normalize(vector3)); ObservableExtensions.Subscribe <TimeInterval <float> >((IObservable <M0>)Observable.FrameTimeInterval <float>((IObservable <M0>)ObservableEasing.Linear(0.2f, false), false), (System.Action <M0>)(x => this.Agent.Rotation = Quaternion.Slerp(rotation, forwardRotation, ((TimeInterval <float>) ref x).get_Value()))); agent.AgentData.Greeted = true; }
private ActorController GetCapturedInSight(AgentActor agent, Actor[] actors) { Actor element = actors.GetElement <Actor>(Random.Range(0, actors.Length)); if (Object.op_Equality((Object)element, (Object)null)) { return((ActorController)null); } ActorController controller = element.Controller; if (Object.op_Equality((Object)controller, (Object)null)) { return((ActorController)null); } Vector3 position = agent.FovTargetPointTable.get_Item(Actor.FovBodyPart.Head).get_position(); foreach (Transform fovTargetPoint in element.FovTargetPoints) { Vector3 vector3 = Vector3.op_Subtraction(position, fovTargetPoint.get_position()); Ray ray; ((Ray) ref ray).\u002Ector(position, vector3); if (Physics.Raycast(ray, ((Vector3) ref vector3).get_magnitude(), LayerMask.op_Implicit(Singleton <Resources> .Instance.DefinePack.MapDefines.MapLayer))) { return((ActorController)null); } } return(controller); }
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); }
private void Complete() { AgentActor agent = this.Agent; agent.UpdateStatus(agent.ActionID, agent.PoseID); int desireKey = Desire.GetDesireKey(Desire.Type.Sleep); agent.SetDesire(desireKey, 0.0f); this.OnCompletedStateTask(); if (Random.Range(0, 100) < 50) { agent.ChangeBehavior(Desire.ActionType.EndTaskSecondSleep); } else { agent.ActivateNavMeshAgent(); agent.SetActiveOnEquipedItem(true); agent.ClearItems(); agent.ClearParticles(); agent.Animation.EndStates(); agent.ResetActionFlag(); agent.SetDefaultStateHousingItem(); if (Object.op_Inequality((Object)agent.CurrentPoint, (Object)null)) { agent.CurrentPoint.SetActiveMapItemObjs(true); agent.CurrentPoint.ReleaseSlot((Actor)agent); agent.CurrentPoint = (ActionPoint)null; } agent.EventKey = (EventType)0; agent.PrevActionPoint = agent.TargetInSightActionPoint; agent.TargetInSightActionPoint = (ActionPoint)null; agent.AgentData.YobaiTrigger = false; } }
public static void SiruPasteCtrl_Proc_PopulateList(ChaControl ___chaFemale) { if (!inHScene || cleanCumAfterH.Value == Tools.CleanCum.Off || cleanCumAfterH.Value == Tools.CleanCum.MerchantOnly || shouldCleanUp == null) { return; } ChaControl chara = ___chaFemale; if (chara == null || chara.isPlayer || shouldCleanUp.Contains(chara) || (manager != null && manager.bMerchant)) { return; } AgentActor agent = Singleton <Map> .Instance.AgentTable.Values.FirstOrDefault(actor => actor != null && actor.ChaControl == chara); if (agent == null) { return; } for (int i = 0; i < 5; i++) { if (chara.GetSiruFlag((ChaFileDefine.SiruParts)i) == 0) { continue; } shouldCleanUp.Add(chara); break; } }
public virtual void OnEnd() { ((Task)this).OnEnd(); if (this._onEndTurnDisposable != null) { this._onEndTurnDisposable.Dispose(); } if (this._onEndActionDisposable != null) { this._onEndActionDisposable.Dispose(); } if (this._onCompleteActionDisposable != null) { this._onCompleteActionDisposable.Dispose(); } AgentActor agent = this.Agent; agent.ChangeDynamicNavMeshAgentAvoidance(); agent.SetActiveOnEquipedItem(true); agent.ChaControl.ChangeLookEyesPtn(0); agent.ChaControl.ChangeLookEyesTarget(0, (Transform)null, 0.5f, 0.0f, 1f, 2f); agent.ChaControl.ChangeLookNeckPtn(3, 1f); agent.ChaControl.ChangeLookNeckTarget(0, (Transform)null, 0.5f, 0.0f, 1f, 0.8f); PlayerActor partner = agent.Partner as PlayerActor; if (!Object.op_Inequality((Object)partner, (Object)null) || !partner.OldEnabledHoldingHand) { return; } ((Behaviour)partner.HandsHolder).set_enabled(true); partner.OldEnabledHoldingHand = false; }
static void HSceneInitMerchant(MerchantActor Merchant, AgentActor agent) { #if DEBUG AdditionalAccessoryControlsPlugin.Instance.Log.LogInfo("HScene Init Merchant"); #endif Singleton <Manager.Map> .Instance.Player.ChaControl.gameObject.GetComponent <AdditionalAccessoryControlsController>().HandleVisibilityRules(hstart: true); hActors.Add(Singleton <Manager.Map> .Instance.Player.ChaControl); if (agent != null) { #if DEBUG AdditionalAccessoryControlsPlugin.Instance.Log.LogInfo($"Sending event for: {agent?.ChaControl?.fileParam?.fullname}"); #endif agent.ChaControl.gameObject.GetComponent <AdditionalAccessoryControlsController>().HandleVisibilityRules(hstart: true); hActors.Add(agent.ChaControl); } if (Merchant != null) { #if DEBUG AdditionalAccessoryControlsPlugin.Instance.Log.LogInfo($"Sending event for: {Merchant?.ChaControl?.fileParam?.fullname}"); #endif Merchant.ChaControl.gameObject.GetComponent <AdditionalAccessoryControlsController>().HandleVisibilityRules(hstart: true); hActors.Add(Merchant.ChaControl); } }
private void CheckPlayer() { List <Actor> toRelease = ListPool <Actor> .Get(); foreach (Actor targetActor in this.Agent.TargetActors) { CollisionState collisionState; if (targetActor is PlayerActor && this.Agent.ActorFarCollisionStateTable.TryGetValue(targetActor.InstanceID, out collisionState) && collisionState == CollisionState.Enter) { toRelease.Add(targetActor); } } if (toRelease.Count > 0) { List <Actor> actorList = ListPool <Actor> .Get(); foreach (Actor actor in toRelease) { actorList.Add(actor); } ActorController capturedInSight = AgentActor.GetCapturedInSight(this.Agent, actorList); ListPool <Actor> .Release(actorList); if (Object.op_Equality((Object)capturedInSight, (Object)null) || !(capturedInSight.Actor is PlayerActor)) { ListPool <Actor> .Release(toRelease); return; } this.Agent.TargetInSightActor = capturedInSight.Actor; } ListPool <Actor> .Release(toRelease); }
void Draw_Info_Texts() { if (controller.agent == null) { return; } AgentActor agent = controller.agent; PlayerActor player = Manager.Map.Instance.Player; Vector3 pos = controller.agent.Position; Sickness sick = agent.AgentData.SickState; string meds = sick.UsedMedicine ? "; Medicated" : ""; double duration = sick.Duration.TotalSeconds; string time = duration > 0 ? $"; {duration.ToString()}s" : ""; GUILayout.Label("Info", sectionLabelStyle); GUILayout.BeginVertical(GUILayout.Width(ENTRY_WIDTH)); { GUILayout.Label($"Location:\n{(int)pos.x}, {(int)pos.y}, {(int)pos.z}"); GUILayout.Label($"Distance to Player:\n{(int)Vector3.Distance(player.Position, pos)}"); GUILayout.Label($"Speed:\n{agent.NavMeshAgent.speed}"); GUILayout.Label($"Total Flavor:\n{controller.ChaControl.fileGameInfo.totalFlavor}"); GUILayout.Label($"State:\n{agent.StateType.ToString()}"); GUILayout.Label($"Desire:\n{agent.Mode.ToString()}"); GUILayout.Label($"Sickness:\n{sick.Name}{time}{meds}"); } GUILayout.EndVertical(); }
public static void CleanUpSiru(AgentStateAction __instance) { if (AI_BetterHScenes.shouldCleanUp == null || AI_BetterHScenes.shouldCleanUp.Count == 0 || __instance == null || __instance.Owner == null) { return; } var tree = (__instance.Owner as AgentBehaviorTree); if (tree == null) { return; } AgentActor agent = tree.SourceAgent; if (agent == null || agent.ChaControl == null || !AI_BetterHScenes.shouldCleanUp.Contains(agent.ChaControl)) { return; } for (int i = 0; i < 5; i++) { ChaFileDefine.SiruParts parts = (ChaFileDefine.SiruParts)i; agent.ChaControl.SetSiruFlag(parts, 0); } AI_BetterHScenes.shouldCleanUp.Remove(agent.ChaControl); }
private void Complete() { AgentActor agent = this.Agent; agent.UpdateStatus(agent.ActionID, agent.PoseID); int desireKey = Desire.GetDesireKey(Desire.Type.Sleep); agent.SetDesire(desireKey, 0.0f); agent.SetStatus(0, 50f); agent.HealSickBySleep(); this.Agent.ActivateNavMeshAgent(); this.Agent.SetActiveOnEquipedItem(true); agent.Animation.EndStates(); agent.ClearItems(); agent.ClearParticles(); if (Object.op_Inequality((Object)agent.CurrentPoint, (Object)null)) { agent.CurrentPoint.SetActiveMapItemObjs(true); agent.CurrentPoint.ReleaseSlot((Actor)agent); agent.CurrentPoint = (ActionPoint)null; } agent.EventKey = (EventType)0; agent.PrevActionPoint = agent.TargetInSightActionPoint; agent.TargetInSightActionPoint = (ActionPoint)null; }
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 TaskStatus OnUpdate() { AgentActor agent = this.Agent; int desireKey = Desire.GetDesireKey(this._key); float? desire = agent.GetDesire(desireKey); if (!desire.HasValue) { return((TaskStatus)1); } if ((double)desire.Value >= (double)this._migrationBorder) { float?motivation = agent.GetMotivation(desireKey); if (motivation.HasValue) { if ((double)motivation.Value >= (double)Singleton <Resources> .Instance.AgentProfile.ActiveMotivationBorder) { return((TaskStatus)2); } agent.SetDesire(desireKey, 0.0f); return((TaskStatus)1); } } return((TaskStatus)1); }
private void Complete() { AgentActor agent = this.Agent; agent.Animation.CrossFadeScreen(-1f); agent.ActivateNavMeshAgent(); agent.SetActiveOnEquipedItem(true); agent.SetStand(agent.Animation.RecoveryPoint, false, 0.0f, 0); agent.Animation.RecoveryPoint = (Transform)null; int desireKey = Desire.GetDesireKey(Desire.Type.H); agent.SetDesire(desireKey, 0.0f); agent.UpdateStatus(agent.ActionID, agent.PoseID); agent.ApplySituationResultParameter(31); agent.ClearItems(); agent.ClearParticles(); agent.ResetActionFlag(); if (Object.op_Inequality((Object)agent.CurrentPoint, (Object)null)) { agent.CurrentPoint.SetActiveMapItemObjs(true); agent.CurrentPoint.ReleaseSlot((Actor)agent); agent.CurrentPoint = (ActionPoint)null; agent.PrevActionPoint = agent.TargetInSightActionPoint; } agent.TargetInSightActionPoint = (ActionPoint)null; agent.SurprisePoseID = new PoseKeyPair?(); agent.Animation.EndIgnoreEvent(); agent.Animation.ResetDefaultAnimatorController(); }
// Updates the behaviour public BehaviourResult UpdateBehaviour(AgentActor agent) { Vector3 agentPos = agent.gameObject.transform.position; // Swaps the patrol points when one is reached if ((agentPos - currentTarget).sqrMagnitude <= 10) { if (currentTarget == patrolPointA) { currentTarget = patrolPointB; } else { currentTarget = patrolPointA; } } Vector3 lookAtTarget = currentTarget - agent.transform.position; // This is used to slow down the turn of robot Quaternion angleToPlayer = Quaternion.LookRotation(lookAtTarget, Vector3.up); agent.gameObject.transform.rotation = Quaternion.Slerp(agent.gameObject.transform.rotation, angleToPlayer, 0.7f); // This is used to add force to the agent to move Vector3 force = (currentTarget - agentPos).normalized * agent.MaxSpeed; agent.AddForce(force - agent.Velocity); return(BehaviourResult.SUCCESS); }
public static void RefreshSheets() { List <ADMSheet> list = new List <ADMSheet>(); foreach (MiniMapControler.IconInfo info in MapUIContainer.Instance.MinimapUI.GetBaseIconInfos()) { BasePoint basePoint = info.Point.GetComponent <BasePoint>(); Map.Instance.GetBasePointOpenState(basePoint.ID, out bool flag); if (!flag) { continue; } list.Add(new ADMSheet(info.Name.Translate(), () => Warp(basePoint.WarpPoint))); } foreach (KeyValuePair <int, AgentActor> pair in Map.Instance.AgentTable) { AgentActor agent = pair.Value; list.Add(new ADMSheet($"{pair.Key}: {agent.CharaName}", () => Warp(agent.NavMeshAgent.transform) )); } sheet.SetSheets(list); }
public virtual void OnEnd() { AgentActor agent = this.Agent; agent.Animation.StopTurnAnimCoroutine(); agent.ChangeDynamicNavMeshAgentAvoidance(); }
public virtual TaskStatus OnUpdate() { if (Object.op_Equality((Object)this._merchant, (Object)null)) { return((TaskStatus)1); } AgentActor partner = this._merchant.Partner as AgentActor; bool flag = Object.op_Inequality((Object)partner, (Object)null); if (flag) { flag = Object.op_Equality((Object)partner.Partner, (Object)this._merchant); } if (flag) { Desire.ActionType mode = partner.Mode; switch (mode) { case Desire.ActionType.GotoLesbianSpot: case Desire.ActionType.EndTaskLesbianH: flag = true; break; default: if (mode != Desire.ActionType.EndTaskLesbianMerchantH) { flag = false; break; } goto case Desire.ActionType.GotoLesbianSpot; } } return(flag ? (TaskStatus)2 : (TaskStatus)1); }
private void Complete() { AgentActor agent = this.Agent; agent.UpdateStatus(agent.ActionID, agent.PoseID); agent.CauseSick(); agent.ApplyFoodParameter(agent.AgentData.CarryingItem); agent.AgentData.CarryingItem = (StuffItem)null; agent.ActivateNavMeshAgent(); agent.SetActiveOnEquipedItem(true); agent.Animation.EndStates(); agent.ClearItems(); agent.ClearParticles(); agent.ResetActionFlag(); agent.SetDefaultStateHousingItem(); if (Object.op_Inequality((Object)agent.CurrentPoint, (Object)null)) { agent.CurrentPoint.SetActiveMapItemObjs(true); agent.CurrentPoint.CreateByproduct(agent.ActionID, agent.PoseID); agent.CurrentPoint.ReleaseSlot((Actor)agent); agent.CurrentPoint = (ActionPoint)null; } agent.EventKey = (EventType)0; agent.PrevActionPoint = agent.TargetInSightActionPoint; agent.TargetInSightActionPoint = (ActionPoint)null; }
protected override void OnCompletedEmoteTask() { AgentActor agent = this.Agent; agent.ApplySituationResultParameter(21); agent.ChangeDynamicNavMeshAgentAvoidance(); }
public void StartTalkSequence(Actor listener, int speakID, int listenID) { switch (listener) { case AgentActor _: IEnumerator enumerator1 = this._talkEnumerator = this.StartTalkSequenceCoroutine(listener, speakID, listenID); if (this._talkDisposable != null) { this._talkDisposable.Dispose(); } this._talkDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)Observable.FromCoroutine((Func <IEnumerator>)(() => enumerator1), false)); AgentActor agentActor = listener as AgentActor; agentActor.CommandPartner = this; agentActor.BehaviorResources.ChangeMode(Desire.ActionType.Idle); break; case MerchantActor _: IEnumerator enumerator2 = this._talkEnumerator = this.StartTalkSequenceCoroutine(listener, speakID, listenID); if (this._talkDisposable != null) { this._talkDisposable.Dispose(); } this._talkDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)Observable.FromCoroutine((Func <IEnumerator>)(() => enumerator2), false)); MerchantActor merchantActor = listener as MerchantActor; merchantActor.CommandPartner = this; merchantActor.ChangeBehavior(Merchant.ActionType.TalkWithAgent); break; } }
public virtual TaskStatus OnUpdate() { AgentActor agent = this.Agent; if (Object.op_Inequality((Object)agent.TargetInSightActionPoint, (Object)null)) { if (this._checkFollowType) { if (agent.TargetInSightActionPoint.AgentDateEventType.Contains(this._eventType)) { return((TaskStatus)2); } } else if (agent.TargetInSightActionPoint.AgentEventType.Contains(this._eventType)) { return((TaskStatus)2); } } if (Object.op_Equality((Object)this._destination, (Object)null)) { if (this._desireIfNotFound != Desire.Type.None) { int desireKey = Desire.GetDesireKey(this._desireIfNotFound); agent.SetDesire(desireKey, 0.0f); agent.ChangeBehavior((Desire.ActionType) this._modeIDIfNotFound); } return((TaskStatus)1); } agent.TargetInSightActionPoint = this._destination; agent.EventKey = this._eventType; this._destination.Reserver = (Actor)agent; return((TaskStatus)2); }
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; }
private void ExitState() { MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None); ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>)Observable.FromCoroutine((Func <IEnumerator>)(() => { PlayerActor player = Singleton <Manager.Map> .Instance.Player; return(player.Controller.State.End((Actor)player)); }), false), 1), (System.Action <M0>)(__ => { PlayerActor player = Singleton <Manager.Map> .Instance.Player; player.CameraControl.CrossFade.FadeStart(-1f); player.PlayerController.ChangeState("Normal"); player.CameraControl.Mode = CameraMode.Normal; MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.InvokeAcception); AgentActor agentPartner = player.AgentPartner; agentPartner.ChangeBehavior(agentPartner.PrevMode); agentPartner.Partner = (Actor)null; agentPartner.IsSlave = false; ((Behaviour)agentPartner.NavMeshAgent).set_enabled(true); Vector3 point = Vector3.op_Addition(player.Position, Vector3.op_Multiply(player.Back, 10f)); LayerMask hlayer = Singleton <Resources> .Instance.DefinePack.MapDefines.HLayer; GameObject[] gameObjectsWithTag = GameObject.FindGameObjectsWithTag(Singleton <Resources> .Instance.DefinePack.MapDefines.OnbuMeshTag); List <MeshCollider> toRelease = ListPool <MeshCollider> .Get(); foreach (GameObject gameObject in gameObjectsWithTag) { MeshCollider[] componentsInChildren = (MeshCollider[])gameObject.GetComponentsInChildren <MeshCollider>(); toRelease.AddRange((IEnumerable <MeshCollider>)componentsInChildren); } float num1 = float.PositiveInfinity; Vector3 vector3_1 = Vector3.get_zero(); using (List <MeshCollider> .Enumerator enumerator = toRelease.GetEnumerator()) { while (enumerator.MoveNext()) { Vector3 vector3_2 = enumerator.Current.NearestVertexTo(point); float num2 = Vector3.Distance(player.Position, vector3_2); if ((double)num2 < (double)num1) { num1 = num2; vector3_1 = vector3_2; } } } ListPool <MeshCollider> .Release(toRelease); NavMeshHit navMeshHit; if (NavMesh.SamplePosition(vector3_1, ref navMeshHit, 100f, -1)) { vector3_1 = ((NavMeshHit) ref navMeshHit).get_position(); } player.Partner.NavMeshAgent.Warp(vector3_1); Vector3 vector3_3 = Vector3.op_Addition(vector3_1, Vector3.op_Multiply(player.Partner.Forward, 10f)); if (NavMesh.SamplePosition(vector3_3, ref navMeshHit, 100f, -1)) { vector3_3 = ((NavMeshHit) ref navMeshHit).get_position(); } player.NavMeshAgent.Warp(vector3_3); player.Partner = (Actor)null; agentPartner.IsVisible = true; })); }