Exemplo n.º 1
0
 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);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 public override void BeginTransition(Navigator navigator, Navigator.ActiveTransition transition)
 {
     base.BeginTransition(navigator, transition);
     ReactionMonitor.Instance reaction_monitor = navigator.GetSMI <ReactionMonitor.Instance>();
     reaction_monitor.PollForReactables(transition);
     if (reaction_monitor.IsReacting())
     {
         transition.anim         = null;
         transition.isLooping    = false;
         transition.end          = transition.start;
         transition.speed        = 1f;
         transition.animSpeed    = 1f;
         transition.x            = 0;
         transition.y            = 0;
         transition.isCompleteCB = (() => !reaction_monitor.IsReacting());
     }
 }
 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);
         }
     }
 }
Exemplo n.º 4
0
 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);
     }
 }