Esempio n. 1
0
        public static IEnumerable<bool> RetreatingAttack(Sprite target, Enemy attacker, float distance, TimeSpan duration, IEnumerable<bool> attack)
        {
            FrostbyteLevel l = This.Game.CurrentLevel as FrostbyteLevel;
            attacker.State = SpriteState.Attacking;

            attacker.isAttackAnimDone = false;
            List<Sprite> targets = new List<Sprite>();
            targets.Add(target);

            TimeSpan endRetreat = This.gameTime.TotalGameTime + duration;

            attacker.Personality.Status = EnemyStatus.Wander;

            while (true)
            {

                attacker.previousFootPos = attacker.GroundPos;
                if (attacker.retreat(targets, distance, 5) || endRetreat < This.gameTime.TotalGameTime)
                {
                    break;
                }

                attacker.checkBackgroundCollisions();
                yield return false;
            }

            foreach(bool o in attack)
            {
                yield return false;
            }

            attacker.isAttackAnimDone = true;
            yield return true;
        }
Esempio n. 2
0
 internal AmbushPersonality(Enemy master)
 {
     this.master = master;
     mStates = States().GetEnumerator();
 }
Esempio n. 3
0
        public static IEnumerable<bool> RammingAttack(Sprite target, Enemy attacker, int baseDamage, TimeSpan duration, Element elem = Element.None)
        {
            FrostbyteLevel l = This.Game.CurrentLevel as FrostbyteLevel;
            attacker.State = SpriteState.Attacking;

            attacker.isAttackAnimDone = false;
            List<Sprite> targets = new List<Sprite>();
            targets.Add(target);

            int dmgcount = 0;
            attacker.Personality.Status = EnemyStatus.Wander;

            while (true)
            {

                attacker.previousFootPos = attacker.GroundPos;
                if (attacker.ram(targets, duration, float.PositiveInfinity, 20))
                {
                    break;
                }

                attacker.checkBackgroundCollisions();

                if (dmgcount++ % 10 == 0 && Collision.CollisionData.Count > 0)
                {
                    List<Tuple<CollisionObject, WorldObject, CollisionObject>> collidedWith;
                    Collision.CollisionData.TryGetValue(attacker, out collidedWith);
                    if (collidedWith != null)
                    {
                        foreach (Tuple<CollisionObject, WorldObject, CollisionObject> detectedCollision in collidedWith)
                        {
                            if (detectedCollision.Item2 is Player && attacker is Enemy)
                            {
                                Damage(attacker, (detectedCollision.Item2 as OurSprite), baseDamage);
                            }
                        }
                    }
                }
                yield return false;
            }

            attacker.isAttackAnimDone = true;
            yield return true;
        }
Esempio n. 4
0
 internal DartWanderPersonality(Enemy master)
 {
     this.master = master;
     mStates = States().GetEnumerator();
 }
Esempio n. 5
0
 internal WanderingMinstrelPersonality(Enemy master)
 {
     this.master = master;
     mStates = States().GetEnumerator();
 }
Esempio n. 6
0
 internal WalkingSentinelPersonality(Enemy master)
 {
     this.master = master;
     mStates = States().GetEnumerator();
 }
Esempio n. 7
0
 internal SwoopingPersonality(Enemy master)
 {
     this.master = master;
     mStates = States().GetEnumerator();
 }
Esempio n. 8
0
 internal PulseChargePersonality(Enemy master)
 {
     this.master = master;
     mStates = States().GetEnumerator();
 }