Exemplo n.º 1
0
        public override bool ActiveMovement()
        {
            if (timer % 300 == 0)
            {
                ai++;
            }
            switch (ai)
            {
            case 0:
                if (canSee() && OnGround())
                {
                    npc.velocity.X -= direction ? 0.25f * -1 : 0.25f;
                }
                if (timer > 90)
                {
                    ArchaeaNPC.VelClampX(npc, -3f, 3f);
                }
                break;

            case 1:
                ai = 0;
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
 public override void AI()
 {
     if (timer > interval)
     {
         timer = 0;
     }
     foreach (Projectile a in bombs)
     {
         if (a != null && a.active)
         {
             if (a.Hitbox.Intersects(target().Hitbox))
             {
                 a.timeLeft = 1;
             }
         }
     }
     if (pattern != Pattern.Attack)
     {
         if (npc.alpha > 0)
         {
             npc.alpha--;
         }
     }
     npc.direction = direction ? 1 : -1;
     if (target().Distance(npc.position) < range && canSee())
     {
         if (npc.velocity.Y == 0f && (timer % 150 == 0 || ArchaeaNPC.OnHurt(npc.life, oldLife, out oldLife)))
         {
             velX            = npc.velocity.X;
             npc.velocity.Y -= randY;
         }
     }
     if (!OnGround())
     {
         npc.velocity.X = velX;
     }
     if (!canSee() || !target().active || target().dead)
     {
         if (FacingWall())
         {
             isBlind = !isBlind;
         }
         if (OnGround())
         {
             npc.velocity.X -= isBlind ? -0.2f : 0.2f;
         }
         ArchaeaNPC.VelClampX(npc, -2f, 2f);
     }
 }