⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bulletplantlistener.java

📁 Java 3D API, 一套完整的3d引擎
💻 JAVA
字号:
import com.threed.jpct.*;

/**
 * A CollisionListener that will be notified when a bullet hits a plant. This
 * listener will be added to every plant.
 */
public class BulletPlantListener implements CollisionListener {
   public boolean requiresPolygonIDs() {
      // not needed in this case...
      return false;
   }

   public void collision(CollisionEvent e) {
      if (e.getType()==CollisionEvent.TYPE_TARGET && e.getSource()!=null) {
         if (e.getSource() instanceof Bullet) {
            // The collision has really been caused by a bullet!
            Bullet bullet=(Bullet) e.getSource();
            Plant plant=(Plant) e.getObject();
            plant.destroy();
            bullet.disable();
         }
      }
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -