Beispiel #1
0
 public override void Update()
 {
     base.Update();
     if (state == 1 || state == 2)
     {
         if (state == 1 && frame > 8)
         {
             GColli gc = new GColli(new Vector2(ang.X * 25 + pos.X, ang.Y * 25 + pos.Y), 20);
             foreach (GameObj ge in PaintKiller.GetObjs())
                 if (ge != tag && ge is GEnemy && ge.IsColliding() && gc.Intersects(ge))
                 {
                     PaintKiller.AddObj(new GEC((gc.pos + ge.pos) / 2, PaintKiller.GetTex("BloodS"), 10));
                     OnStrike(ge.Hit(10), (GEnemy)ge);
                     ge.Knockback(gc.pos, 5);
                     if (tag != null) state = 2;
                     else tag = ge;
                     break;
                 }
                 else if (ge is GPArrowE && gc.Intersects(ge)) ge.Kill();
         }
         if (++frame > 24) SetState(0);
     }
     else if (state == 5)
     {
         if (frame > 8 && frame < 40)
         {
             if (tag == null) tag = new List<GameObj>();
             GColli gc = new GColli(pos, 36);
             foreach (GameObj ge in PaintKiller.GetObjs())
                 if (ge is GEnemy && ge.IsColliding() && gc.Intersects(ge))
                 {
                     PaintKiller.AddObj(new GEC((gc.pos + ge.pos) / 2, PaintKiller.GetTex("BloodS"), 10));
                     if (!((List<GameObj>)tag).Contains(ge))
                     {
                         ((List<GameObj>)tag).Add(ge);
                         OnStrike(ge.Hit(14), (GEnemy)ge);
                     }
                     ge.Knockback(gc.pos, 12);
                     ((List<GameObj>)tag).Add(ge);
                     break;
                 }
                 else if (ge is GPArrowE && gc.Intersects(ge)) ge.Kill();
         }
         if (++frame > 48) SetState(0);
     }
     else if (state == 7)
     {
         if (tag == null) tag = new List<GameObj>();
         spd += ang * GetAcc() * 2;
         fce += ang * GetAcc();
         if (++frame % 3 == 0) PaintKiller.AddObj(new GEC(pos, PaintKiller.GetTex("GPlayer"), 15));
         GColli gc = new GColli(new Vector2(ang.X * 25 + pos.X, ang.Y * 25 + pos.Y), 20);
         foreach (GameObj ge in PaintKiller.GetObjs())
             if (ge != tag && ge is GEnemy && ge.IsColliding() && gc.Intersects(ge))
             {
                 PaintKiller.AddObj(new GEC((gc.pos + ge.pos) / 2, PaintKiller.GetTex("BloodS"), 10));
                 if (!((List<GameObj>)tag).Contains(ge))
                 {
                     ((List<GameObj>)tag).Add(ge);
                     OnStrike(ge.Hit(18), (GEnemy)ge);
                 }
                 ge.Knockback(gc.pos, 7);
                 break;
             }
             else if (ge is GPArrowE && gc.Intersects(ge)) ge.Kill();
         if (frame > 40) SetState(0);
     }
 }
Beispiel #2
0
 public override void Update()
 {
     if (state == 0)
     {
         GPlayer close = null;
         float dist = 0;
         foreach (GPlayer gp in PaintKiller.GetPlrs())
             if (close == null || DistanceSq(gp) < dist)
             {
                 close = gp;
                 dist = DistanceSq(close);
             }
         if (close != null)
         {
             float f = Radius + close.Radius + 9;
             Vector2 v = close.pos - pos + close.spd * 5;
             v.Normalize();
             if (dist <= f * f)
             {
                 spd += v * GetAcc() * 2.5F;
                 SetState(PaintKiller.rand.Next(5) == 0 ? (byte)5 : (byte)1, false);
                 UpdateAngle(true);
             }
             else spd += v * GetAcc();
         }
     }
     else if ((state == 5 || state == 1) && ++frame > 12)
     {
         if (state == 5) spd += ang * GetAcc();
         if (frame < 24)
         {
             GColli gc = new GColli(new Vector2(ang.X * 25 + pos.X, ang.Y * 25 + pos.Y), 10);
             foreach (GPlayer gp in PaintKiller.GetPlrs())
                 if (gp.IsColliding() && gc.Intersects(gp))
                 {
                     PaintKiller.AddObj(new GEC((gc.pos + gp.pos) / 2, PaintKiller.GetTex("BloodS"), 20));
                     gp.Knockback(gc.pos, 2);
                     gp.Hit(4);
                     state = 2;
                     break;
                 }
         }
         else if (frame > 36) SetState(0);
     }
     else if (state == 2 && ++frame > 36) SetState(0);
     else if (state == 4 && ++frame > 40) dead = true;
 }
Beispiel #3
0
 public override void Update()
 {
     if (state == 0)
     {
         GPlayer close = null;
         float dist = 0;
         foreach (GPlayer gp in PaintKiller.GetPlrs())
             if (close == null || DistanceSq(gp) < dist)
             {
                 close = gp;
                 dist = DistanceSq(close);
             }
         if (close != null)
         {
             float f2 = Radius + close.Radius + 75;
             float f1 = Radius + close.Radius + 50;
             Vector2 v = close.pos - pos;
             if (dist <= f1 * f1)
             {
                 v += close.spd * 5;
                 v.Normalize();
                 spd += v * GetAcc();
                 SetState(1, false);
                 UpdateAngle(true);
             }
             else if (dist <= f2 * f2)
             {
                 v += close.spd * 35;
                 v.Normalize();
                 spd += v * GetAcc();
                 SetState(1, false);
                 UpdateAngle(true);
             }
             else
             {
                 v.Normalize();
                 spd += v * GetAcc();
             }
             this.ToString();
         }
     }
     else if (state == 1 && ++frame > 4)
     {
         if (frame < 30)
         {
             spd += ang * GetAcc();
             fce += ang * GetAcc() / 2;
         }
         if (frame > 12 && frame < 24)
         {
             GColli gc = new GColli(new Vector2(ang.X * Radius * 1.5F + pos.X, ang.Y * Radius * 1.5F + pos.Y), 14);
             foreach (GPlayer gp in PaintKiller.GetPlrs())
                 if (gp.IsColliding() && gc.Intersects(gp))
                 {
                     PaintKiller.AddObj(new GEC((gc.pos + gp.pos) / 2, PaintKiller.GetTex("BloodS"), 20));
                     gp.Knockback(gc.pos, 7);
                     gp.Hit(8);
                     state = 2;
                     break;
                 }
         }
         else if (frame > 36) SetState(0);
     }
     else if (state == 2 && ++frame > 36) SetState(0);
     else if (state == 4 && ++frame > 40) dead = true;
 }