Пример #1
0
 public AiFlySearch(EntityLiving baseentity, int spd, int lAnmStart, int lAnmEnd, int rAnmStart, int rAnmEnd)
 {
     HostEntity = baseentity;
     _speed = spd;
     _leftAnimeStartIndex = lAnmStart;
     _rightAnimeStartIndex = rAnmStart;
     _leftAnimeEndIndex = lAnmEnd;
     _rightAnimeEndIndex = rAnmEnd;
 }
Пример #2
0
 public AiKillMonster(EntityLiving el)
 {
     HostEntity = el;
 }
Пример #3
0
 public AiArch(EntityLiving el)
 {
     HostEntity = el;
 }
Пример #4
0
 public AiKillDefender(EntityLiving el)
 {
     HostEntity = el;
 }
Пример #5
0
 protected virtual void SwitchMode()
 {
     if (!IsRunning)
     {
         IsRunning = true;
         CollisionAIs.Add(Killai);
         Mutekitime = Mutekimax;
         Owner = null;
         SoundUtility.PlaySound(Sounds.Killed);
         Velocity.X = Parent.MainEntity.Location.X < Location.X ? Speed : -Speed;
         //Location.X += Velocity.X * 8;
         Velocity.Y = 0;
     }
     else
     {
         IsRunning = false;
         Mutekitime = Mutekimax;
         if (CollisionAIs.Contains(Killai))
             CollisionAIs.Remove(Killai);
         SoundUtility.PlaySound(Sounds.Stepped);
         Velocity.X = 0;
         Velocity.Y = 0;
     }
 }
Пример #6
0
        public override void OnUpdate(Status ks)
        {
            if (IsDying)
            {
                base.OnUpdate(ks);
                return;
            }
            if (Mutekitime > 0)
                Mutekitime--;
            if ((CollisionLeft() == ObjectHitFlag.Hit) || (Location.X <= 0))
                Velocity.X = Speed;
            if ((CollisionRight() == ObjectHitFlag.Hit) || (Location.X >= GameEngine.Map.Width * 16 - 1))
                Velocity.X = -Speed;

            if ((Owner != null) && !ks.Inlshift)
            {
                SwitchMode();
                Owner = null;
            }
            if ((Owner != null) && !IsRunning)
                foreach (EntityLiving ep in Parent.FindEntitiesByType<EntityLiving>())
                {
                    if ((ep == this) || ep.IsDying || (ep.MyGroup == EntityGroup.Friend) ||
                        ((ep.MyGroup != EntityGroup.Enemy) && !(ep is EntityTurcosShell)))
                        continue;
                    if (new Rectangle((int) ep.Location.X, (int) ep.Location.Y, ep.Size.Width, ep.Size.Height)
                        .CheckCollision(new Rectangle((int) Owner.Location.X - 4, (int) Owner.Location.Y - 4, Owner.Size.Width + 8,
                            Owner.Size.Height + 8)))
                    {
                        ep.Kill();
                        IsDead = true;
                    }
                }
            if ((Mutekitime == 0) && !IsRunning && !ks.Inlshift &&
                new RectangleF(Parent.MainEntity.Location, Parent.MainEntity.Size).CheckCollision(new RectangleF(Location, Size)))
                SwitchMode();
            base.OnUpdate(ks);
        }