Ejemplo n.º 1
0
        public IEnumerable <Act.Status> SummonSkeletons()
        {
            while (true)
            {
                Skeletons.RemoveAll(skeleton => skeleton.IsDead);
                if (SummonTimer.HasTriggered && Skeletons.Count < MaxSkeletons)
                {
                    SummonTimer.Reset(SummonTimer.TargetTimeSeconds);
                    for (int i = Skeletons.Count; i < MaxSkeletons; i += 2)
                    {
                        SummonSkeleton();
                    }
                    yield return(Act.Status.Success);
                }
                else if (SummonTimer.HasTriggered)
                {
                    yield return(Act.Status.Success);
                }
                SummonTimer.Update(DwarfTime.LastTime);

                if (WanderTimer.HasTriggered)
                {
                    Physics.ApplyForce(MathFunctions.RandVector3Box(-5f, 5f, 0.01f, 0.01f, -5f, 5f), 1f);
                    GatherSkeletons();
                }
                WanderTimer.Update(DwarfTime.LastTime);

                if (AttackTimer.HasTriggered)
                {
                    OrderSkeletonsToAttack();
                }
                AttackTimer.Update(DwarfTime.LastTime);
                yield return(Act.Status.Running);
            }
        }
Ejemplo n.º 2
0
        public IEnumerable <Act.Status> SummonSkeletons()
        {
            while (true)
            {
                Skeletons.RemoveAll(skeleton => skeleton.IsDead);
                Creature.CurrentCharacterMode  = CharacterMode.Idle;
                Creature.OverrideCharacterMode = false;

                SummonTimer.Update(DwarfTime.LastTime);
                if (SummonTimer.HasTriggered && Skeletons.Count < MaxSkeletons)
                {
                    Creature.CurrentCharacterMode  = Creature.Stats.CurrentClass.AttackMode;
                    Creature.OverrideCharacterMode = true;
                    Creature.Sprite.ReloopAnimations(Creature.Stats.CurrentClass.AttackMode);
                    SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_ic_necromancer_summon, Position, true);
                    SummonTimer.Reset(SummonTimer.TargetTimeSeconds);
                    for (int i = Skeletons.Count; i < MaxSkeletons; i += 2)
                    {
                        SummonSkeleton();
                    }
                    yield return(Act.Status.Success);
                }
                else if (SummonTimer.HasTriggered)
                {
                    yield return(Act.Status.Success);
                }

                GatherSkeletonsTimer.Update(DwarfTime.LastTime);
                if (GatherSkeletonsTimer.HasTriggered)
                {
                    var wander = new WanderAct(this, GatherSkeletonsTimer.TargetTimeSeconds, 1.0f, 1.0f);

                    foreach (var status in wander.Run())
                    {
                        GatherSkeletons();
                        yield return(Act.Status.Running);
                    }
                }

                AttackTimer.Update(DwarfTime.LastTime);
                if (AttackTimer.HasTriggered)
                {
                    OrderSkeletonsToAttack();
                }

                yield return(Act.Status.Running);
            }
        }