public override bool Update(TerraSpirit spirit, Rectangle bounds)
        {
            if (timer >= 0 && timer % 120 == 0)
            {
                Vector2 position  = spirit.GetTarget().Center - origin;
                int     i         = (int)position.X / interval;
                int     j         = (int)position.Y / interval;
                Vector2 bulletPos = origin + interval * new Vector2(i + 0.5f, j + 0.5f);
                if (timer % 360 == 0)
                {
                    spirit.bullets.Add(new BulletBeamBig(bulletPos, interval, MathHelper.PiOver2, 120));
                }
                else if (timer % 360 == 120)
                {
                    spirit.bullets.Add(new BulletBeamBig(bulletPos, interval, 0f, 120));
                }
                else if (timer % 360 == 240)
                {
                    spirit.bullets.Add(new BulletBeamBig(bulletPos, interval, MathHelper.PiOver2, 120));
                    spirit.bullets.Add(new BulletBeamBig(bulletPos, interval, 0f, 120));
                }
            }

            rotation += rotSpeed;
            timer++;
            return(timer < maxTime);
        }
Exemplo n.º 2
0
        public override bool Update(TerraSpirit spirit, Rectangle bounds)
        {
            Vector2 offset = endPos - position;

            if (offset.Length() < speed)
            {
                position = endPos;
                if (timer % 30 == 0)
                {
                    Vector2 target   = spirit.GetTarget().Center;
                    Vector2 shootVel = target - position;
                    if (shootVel == Vector2.Zero)
                    {
                        shootVel = new Vector2(0f, -1f);
                    }
                    shootVel.Normalize();
                    shootVel *= 12f;
                    var bullet = new BulletSingleMove(position, shootVel);
                    spirit.bullets.Add(bullet);
                }
                if (timer >= 120)
                {
                    return(false);
                }
                timer++;
                return(true);
            }
            offset.Normalize();
            position += speed * offset;
            return(true);
        }
 public override void Behavior()
 {
     Timer++;
     if (Timer >= 90)
     {
         Timer = 0;
         TerraSpirit spirit = (TerraSpirit)Spirit.modNPC;
         Player      target = spirit.GetTarget();
         spirit.bullets.Add(new BulletExplode(npc.Center, target.Center));
     }
 }
Exemplo n.º 4
0
        public override bool Update(TerraSpirit spirit, Rectangle bounds)
        {
            Vector2 target = spirit.GetTarget().Center;

            position += (target - position) * speed;
            timer++;
            if (timer % interval == 0)
            {
                Bullet newBullet = action(position, spirit);
                if (newBullet != null)
                {
                    spirit.bullets.Add(newBullet);
                }
            }
            return(timer < life);
        }
Exemplo n.º 5
0
        public override void Behavior()
        {
            TerraSpirit spirit = (TerraSpirit)Spirit.modNPC;
            Vector2     target = spirit.GetTarget().Center;

            Timer++;
            if (Timer % 8 == 4)
            {
                Vector2 offset = target - npc.Center;
                Vector2 normal = new Vector2(-offset.Y, offset.X);
                spirit.bullets.Insert(0, new BulletVoidWorld(target + offset));
                spirit.bullets.Insert(0, new BulletVoidWorld(target - offset));
                spirit.bullets.Insert(0, new BulletVoidWorld(target + normal));
                spirit.bullets.Insert(0, new BulletVoidWorld(target - normal));
            }
            else if (Timer % 8 == 0)
            {
                spirit.bullets.Insert(0, new BulletVoidWorld(target));
            }
            if (Timer % 90 == 0)
            {
                spirit.bullets.Add(new BulletExplode(npc.Center, target));
            }
        }