Exemple #1
0
 public virtual void AbilityTick()
 {
     VerbTracker.VerbsTick();
     if (def.warmupMote != null && verb.WarmingUp)
     {
         if (warmupMote == null || warmupMote.Destroyed)
         {
             warmupMote = MoteMaker.MakeStaticMote(pawn.DrawPos + def.moteDrawOffset, pawn.Map, def.warmupMote);
         }
         else
         {
             warmupMote.Maintain();
         }
     }
     if (verb.WarmingUp && !CanApplyOn(verb.CurrentTarget))
     {
         verb.WarmupStance?.Interrupt();
         verb.Reset();
     }
     if (cooldownTicks > 0)
     {
         cooldownTicks--;
         if (cooldownTicks == 0 && def.sendLetterOnCooldownComplete)
         {
             Find.LetterStack.ReceiveLetter("AbilityReadyLabel".Translate(def.LabelCap), "AbilityReadyText".Translate(pawn, def.label), LetterDefOf.NeutralEvent, new LookTargets(pawn));
         }
     }
 }
Exemple #2
0
 public override void CompTick()
 {
     base.CompTick();
     if (verbTracker.AllVerbs?[0]?.caster != null)
     {
         verbTracker.VerbsTick();
     }
 }
 public void NativeVerbsTick()
 {
     verbTracker.VerbsTick();
 }
 public override void Tick()
 {
     base.Tick();
     verbTracker.VerbsTick();
 }
 public virtual void AbilityTick()
 {
     VerbTracker.VerbsTick();
     if (def.warmupMote != null && Casting)
     {
         Vector3 vector = pawn.DrawPos + def.moteDrawOffset;
         vector += (verb.CurrentTarget.CenterVector3 - vector) * def.moteOffsetAmountTowardsTarget;
         if (warmupMote == null || warmupMote.Destroyed)
         {
             warmupMote = MoteMaker.MakeStaticMote(vector, pawn.Map, def.warmupMote);
         }
         else
         {
             warmupMote.exactPosition = vector;
             warmupMote.Maintain();
         }
     }
     if (verb.WarmingUp)
     {
         if (!(def.targetWorldCell ? CanApplyOn(pawn.CurJob.globalTarget) : CanApplyOn(verb.CurrentTarget)))
         {
             if (def.targetWorldCell)
             {
                 pawn.jobs.EndCurrentJob(JobCondition.Incompletable);
             }
             verb.WarmupStance?.Interrupt();
             verb.Reset();
             preCastActions.Clear();
         }
         else
         {
             for (int num = preCastActions.Count - 1; num >= 0; num--)
             {
                 if (preCastActions[num].ticksAwayFromCast >= verb.WarmupTicksLeft)
                 {
                     preCastActions[num].action(verb.CurrentTarget, verb.CurrentDestination);
                     preCastActions.RemoveAt(num);
                 }
             }
         }
     }
     if (pawn.Spawned && Casting)
     {
         if (def.warmupSound != null)
         {
             if (soundCast == null || soundCast.Ended)
             {
                 soundCast = def.warmupSound.TrySpawnSustainer(SoundInfo.InMap(new TargetInfo(pawn.Position, pawn.Map), MaintenanceType.PerTick));
             }
             else
             {
                 soundCast.Maintain();
             }
         }
         if (!wasCastingOnPrevTick && def.warmupStartSound != null)
         {
             def.warmupStartSound.PlayOneShot(new TargetInfo(pawn.Position, pawn.Map));
         }
         if (def.warmupPreEndSound != null && verb.WarmupTicksLeft == def.warmupPreEndSoundSeconds.SecondsToTicks())
         {
             def.warmupPreEndSound.PlayOneShot(new TargetInfo(pawn.Position, pawn.Map));
         }
     }
     if (cooldownTicks > 0)
     {
         cooldownTicks--;
         if (cooldownTicks == 0 && def.sendLetterOnCooldownComplete)
         {
             Find.LetterStack.ReceiveLetter("AbilityReadyLabel".Translate(def.LabelCap), "AbilityReadyText".Translate(pawn, def.label), LetterDefOf.NeutralEvent, new LookTargets(pawn));
         }
     }
     for (int num2 = maintainedEffecters.Count - 1; num2 >= 0; num2--)
     {
         Effecter first = maintainedEffecters[num2].First;
         if (first.ticksLeft > 0)
         {
             TargetInfo second = maintainedEffecters[num2].Second;
             first.EffectTick(second, second);
             first.ticksLeft--;
         }
         else
         {
             first.Cleanup();
             maintainedEffecters.RemoveAt(num2);
         }
     }
     wasCastingOnPrevTick = Casting;
 }