timebehavior.java

来自「java3D game engine design of the source 」· Java 代码 · 共 36 行

JAVA
36
字号

// TimeBehavior.java
// Andrew Davison, April 2005, ad@fivedots.coe.psu.ac.th

/* Update the alien sprite every timeDelay ms by calling
   its update() method.
   This class is the Java 3D version of a Timer.
*/

import java.util.Enumeration;
import javax.media.j3d.*;


public class TimeBehavior extends Behavior
{
  private WakeupCondition timeOut;
  private AlienSprite alien;

  public TimeBehavior(int timeDelay, AlienSprite as)
  { alien = as;
    timeOut = new WakeupOnElapsedTime(timeDelay);
  }

  public void initialize()
  { wakeupOn( timeOut );
  }

  public void processStimulus( Enumeration criteria )
  { // ignore criteria
    alien.update();
    wakeupOn( timeOut );
  } // end of processStimulus()


}  // end of TimeBehavior class

⌨️ 快捷键说明

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