Java Reference
In-Depth Information
Figure 15. Third code segment of PostBehavior.java
73.
public void setBehaviorObjectPartner(Behavior behaviorObject)
74.
{
75.
pairPostCondition = new WakeupOnBehaviorPost(behaviorObject, 1);
76.
}
77.
78.
public void initialize()
79.
{
80.
this.wakeupOn(pairPostCondition);
81.
transX = 0.7f;
82.
}
83.
84.
public void processStimulus(Enumeration criteria)
85.
{
86.
if (criteria.nextElement().equals(pairPostCondition))
87.
{
88.
System.out.println("ready to shift");
89.
this.wakeupOn(AWTEventCondition);
90.
transX = 0.7f;
91.
}
92.
else
93.
{
94.
if (transX > 0.0)
95.
{
96.
transX -= 0.1;
97.
trans.set(new Vector3f((float)transX,0.0f,0.0f));
98.
targetTG.setTransform(trans);
99.
this.wakeupOn(wakeupNextFrame);
100.
}
101.
else
102.
{
103.
System.out.println("block shifted left");
104.
this.wakeupOn(pairPostCondition);
105.
postId(2);
106.
}
107.
}
108.
}
109.
110.
}
111.
112. }
Search WWH ::




Custom Search