Beispiel #1
0
 public EntityModokee(Vector pnt, Tile[] obj, byte[,,] chips, EntityList par)
 {
     Location = pnt;
     Mpts     = obj;
     Map      = chips;
     Parent   = par;
     Size     = new Size(32, 16);
     MainAi   = new AiFlySine(this, 1, 0, 1, 4, 5);
     CollisionAIs.Add(new AiKillDefender(this));
 }
 public override void OnUpdate()
 {
     if (Velocity.Y < 0)
     {
         Velocity.Y += 0.1f;
     }
     else if (MainAi == null)
     {
         MainAi = new AiFlySine(this, 0, 5, 5, 5, 5);
     }
     foreach (var entity in Parent.FindEntitiesByType <EntityPlayer>())
     {
         var ep = (EntityPlayer)entity;
         if (!ep.IsDying && new RectangleF(ep.Location.ToPoint(), ep.Size).CheckCollision(new RectangleF(Location.ToPoint(), Size)))
         {
             ep.Life++;
             DESound.Play(Sounds.LifeUp);
             IsDead = true;
         }
     }
     base.OnUpdate();
 }