public EffectInstance(GameObject game_object, Effect effect, bool should_save) : base(game_object, effect) { this.effect = effect; shouldSave = should_save; ConfigureStatusItem(); if (effect.showInUI) { KSelectable component = base.gameObject.GetComponent <KSelectable>(); if (!component.GetStatusItemGroup().HasStatusItemID(statusItem)) { component.AddStatusItem(statusItem, this); } } if (effect.triggerFloatingText && (Object)PopFXManager.Instance != (Object)null) { PopFXManager.Instance.SpawnFX(PopFXManager.Instance.sprite_Plus, effect.Name, game_object.transform, 1.5f, false); } if (!string.IsNullOrEmpty(effect.emoteAnim)) { ReactionMonitor.Instance sMI = base.gameObject.GetSMI <ReactionMonitor.Instance>(); if (sMI != null) { if (effect.emoteCooldown < 0f) { SelfEmoteReactable selfEmoteReactable = (SelfEmoteReactable) new SelfEmoteReactable(game_object, effect.Name + "_Emote", Db.Get().ChoreTypes.Emote, effect.emoteAnim, 100000f, 20f, float.PositiveInfinity).AddStep(new EmoteReactable.EmoteStep { anim = (HashedString)"react" }); selfEmoteReactable.AddPrecondition(NotInATube); if (effect.emotePreconditions != null) { foreach (Reactable.ReactablePrecondition emotePrecondition in effect.emotePreconditions) { selfEmoteReactable.AddPrecondition(emotePrecondition); } } sMI.AddOneshotReactable(selfEmoteReactable); } else { reactable = new SelfEmoteReactable(game_object, effect.Name + "_Emote", Db.Get().ChoreTypes.Emote, effect.emoteAnim, effect.emoteCooldown, 20f, float.PositiveInfinity).AddStep(new EmoteReactable.EmoteStep { anim = (HashedString)"react" }); reactable.AddPrecondition(NotInATube); if (effect.emotePreconditions != null) { foreach (Reactable.ReactablePrecondition emotePrecondition2 in effect.emotePreconditions) { reactable.AddPrecondition(emotePrecondition2); } } } } } }
private void RegisterReactEmotePair(string reactable_id, string kanim_file_name, float max_trigger_time) { if (!((Object)base.gameObject == (Object)null)) { ReactionMonitor.Instance sMI = base.gameObject.GetSMI <ReactionMonitor.Instance>(); if (sMI != null) { EmoteChore emoteChore = new EmoteChore(base.gameObject.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteIdle, kanim_file_name, new HashedString[1] { "react" }, null); SelfEmoteReactable selfEmoteReactable = new SelfEmoteReactable(base.gameObject, reactable_id, Db.Get().ChoreTypes.Cough, kanim_file_name, max_trigger_time, 20f, float.PositiveInfinity); emoteChore.PairReactable(selfEmoteReactable); selfEmoteReactable.AddStep(new EmoteReactable.EmoteStep { anim = (HashedString)"react" }); selfEmoteReactable.PairEmote(emoteChore); sMI.AddOneshotReactable(selfEmoteReactable); } } }
public void RegisterHitReaction() { ReactionMonitor.Instance sMI = base.gameObject.GetSMI <ReactionMonitor.Instance>(); if (sMI != null) { SelfEmoteReactable selfEmoteReactable = new SelfEmoteReactable(base.gameObject, "Hit", Db.Get().ChoreTypes.Cough, "anim_hits_kanim", 0f, 1f, 1f); selfEmoteReactable.AddStep(new EmoteReactable.EmoteStep { anim = (HashedString)"hit" }); if (!base.gameObject.GetComponent <Navigator>().IsMoving()) { EmoteChore emoteChore = new EmoteChore(base.gameObject.GetComponent <ChoreProvider>(), Db.Get().ChoreTypes.EmoteIdle, "anim_hits_kanim", new HashedString[1] { "hit" }, null); emoteChore.PairReactable(selfEmoteReactable); selfEmoteReactable.PairEmote(emoteChore); } sMI.AddOneshotReactable(selfEmoteReactable); } }