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); } } } } } }
protected new virtual void End(string reason) { if (reactable != null) { reactable.PairEmote(null); reactable.Cleanup(); reactable = null; } base.End(reason); }
public Reactable GetReactable() { GameObject gameObject = base.master.gameObject; HashedString id = "PeriodicEmoteSickness"; ChoreType emote = Db.Get().ChoreTypes.Emote; HashedString animset = "anim_sneeze_kanim"; float cooldown = periodicEmoteSickness.cooldown; SelfEmoteReactable selfEmoteReactable = new SelfEmoteReactable(gameObject, id, emote, animset, 0f, cooldown, float.PositiveInfinity); HashedString[] anims = periodicEmoteSickness.anims; foreach (HashedString anim in anims) { selfEmoteReactable.AddStep(new EmoteReactable.EmoteStep { anim = anim }); } return(selfEmoteReactable); }
public void CancelOneShotReactable(SelfEmoteReactable cancel_target) { int num = oneshotReactables.Count - 1; Reactable reactable; while (true) { if (num < 0) { return; } reactable = oneshotReactables[num]; if (cancel_target == reactable) { break; } num--; } reactable.Cleanup(); }
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); } }
public void PairReactable(SelfEmoteReactable reactable) { this.reactable = reactable; }
public void AddOneshotReactable(SelfEmoteReactable reactable) { oneshotReactables.Add(reactable); }