Exemple #1
0
 public void hitByExplosion(
     CollisionParticipant source, LocalObject obj, DecalManager decal, CollisionEvent ce) {
   if (shield.getVisibility()) {
     // If the shield is visible, we are invincible...
     return;
   }
   Event event = new Event(Event.EXPLOSION_HIT, -99, obj.getObjectID(), obj.getClientID());
   source.getEventQueue().add(event);
 }
Exemple #2
0
 public void setToLocalObject(LocalObject lo) {
   super.setToLocalObject(lo);
   if (lo.isInvincible() && !shield.getVisibility()) {
     shield.setVisibility(true);
   } else {
     if (!lo.isInvincible()) {
       shield.setVisibility(false);
     }
   }
 }
Exemple #3
0
 public void init(int id) {
   // This instance of LocalObject is used in the view only. The crates
   // aren't real
   // LocalObject/ClientObject-entities as they are not transfered to the
   // server.
   // However, events and collision listeners need some information from
   // the LocalObject
   lob = new LocalObject(-99);
   lob.setObjectID(id);
 }
Exemple #4
0
 public void hitByExplosion(
     CollisionParticipant source, LocalObject obj, DecalManager decal, CollisionEvent ce) {
   if (!isInactive()) {
     Event event = new Event(Event.CRATE_HIT, -99, obj.getObjectID(), -99);
     int[] ids = ce.getPolygonIDs();
     if (ids != null) {
       // The Crates on the bot client don't return those IDs...and
       // they don't have to.
       PolygonManager pm = getPolygonManager();
       SimpleVector normal = pm.getTransformedNormal(ids[0]);
       event.setOrigin(normal);
     }
     source.getEventQueue().add(event);
   }
 }