<
Viewpoint position='0 20 5'
orientation='1 0 0 -1'/>
<
NavigationInfo
type='"NONE"'
/>
<
Transform DEF='
UFO-Tf'>
<
Transform scale='1 0.5 0.5'>
<
Shape>
<
Appearance>
<Material DEF='UFO-Mt0' diffuseColor='0.8 0.8 0.9'/>
</
Appearance>
<
Sphere/>
</
Shape>
</
Transform>
<
Transform translation='1 0 0.2'
scale='0.3 0.3 1'>
<
Shape>
<
Appearance DEF='
UFO-Ap'>
<Material DEF='UFO-Mt1' diffuseColor='0.8 0.9 0.8'/>
</
Appearance>
<
Sphere/>
</
Shape>
</
Transform>
<
Transform translation='-1 0 0.2'
scale='0.3 0.3 1'>
<
Shape>
<Appearance USE='UFO-Ap'/>
<Sphere/>
</
Shape>
</
Transform>
</
Transform>
<
TimeSensor DEF='
UFOOI-TiS'
loop='TRUE'/>
<
OrientationInterpolator DEF='
UFO-OI'
key='0 0.25 0.5 0.75 1'
keyValue='0 0 1 0
0 0 1 1.5708
0 0 1 3.1416
0 0 1 4.7124
0 0 1 6.2832
'
/>
<
ROUTE fromNode='
UFOOI-TiS'
fromField='fraction_changed'
toNode='
UFO-OI'
toField='set_fraction'/>
<
ROUTE fromNode='
UFO-OI'
fromField='value_changed'
toNode='
UFO-Tf'
toField='rotation'/>
<
TimeSensor DEF='
UFOPI-TiS'
loop='TRUE'
cycleInterval='10'/>
<
PositionInterpolator DEF='
UFO-PI'
key='0 0.5 1'
keyValue='-10 0 -20
10 0 -20
-10 0 -20
'
/>
<
ROUTE fromNode='
UFOPI-TiS'
fromField='fraction_changed'
toNode='
UFO-PI'
toField='set_fraction'/>
<
ROUTE fromNode='
UFO-PI'
fromField='value_changed'
toNode='
UFO-Tf'
toField='translation'/>
<
Transform DEF='
Meteo0-Tf'>
<
Shape DEF='
Meteo-Sp'>
<
Appearance>
<Material diffuseColor='0.8 0 0'/>
</
Appearance>
<
Sphere/>
</
Shape>
</
Transform>
<
TimeSensor DEF='
Meteo0-TiS'
loop='TRUE'
cycleInterval='5'/>
<
PositionInterpolator DEF='
Meteo0-PI'
key='0 1'
keyValue='-12 0 -17
12 0 -17
'
/>
<
ROUTE fromNode='
Meteo0-TiS'
fromField='fraction_changed'
toNode='
Meteo0-PI'
toField='set_fraction'/>
<
ROUTE fromNode='
Meteo0-PI'
fromField='value_changed'
toNode='
Meteo0-Tf'
toField='translation'/>
<
Transform DEF='
Meteo1-Tf'>
<Shape USE='Meteo-Sp'/>
</
Transform>
<
TimeSensor DEF='
Meteo1-TiS'
loop='TRUE'
cycleInterval='7'/>
<
PositionInterpolator DEF='
Meteo1-PI'
key='0 1'
keyValue='12 0 -14
-12 0 -14
'
/>
<
ROUTE fromNode='
Meteo1-TiS'
fromField='fraction_changed'
toNode='
Meteo1-PI'
toField='set_fraction'/>
<
ROUTE fromNode='
Meteo1-PI'
fromField='value_changed'
toNode='
Meteo1-Tf'
toField='translation'/>
<
Transform DEF='
Meteo2-Tf'>
<Shape USE='Meteo-Sp'/>
</
Transform>
<
TimeSensor DEF='
Meteo2-TiS'
loop='TRUE'
cycleInterval='8'/>
<
PositionInterpolator DEF='
Meteo2-PI'
key='0 1'
keyValue='-12 0 -11
12 0 -11
'
/>
<
ROUTE fromNode='
Meteo2-TiS'
fromField='fraction_changed'
toNode='
Meteo2-PI'
toField='set_fraction'/>
<
ROUTE fromNode='
Meteo2-PI'
fromField='value_changed'
toNode='
Meteo2-Tf'
toField='translation'/>
<
Transform DEF='
Missile-Tf'>
<
Switch DEF='
Missile-Sw'
whichChoice='0'>
<
Transform rotation='1 0 0 -1.5708'>
<
Shape>
<
Appearance>
<Material diffuseColor='1 0.9 0.5'/>
</
Appearance>
<
Cone bottomRadius='0.5'/>
</
Shape>
</
Transform>
<
Transform DEF='
Expl-Tf'>
<
Shape>
<
Appearance>
<Material DEF='Expl-Mt' diffuseColor='1 0.5 0'/>
</
Appearance>
<
Sphere radius='0.7'/>
</
Shape>
</
Transform>
</
Switch>
</
Transform>
<
TimeSensor DEF='
Missile-TiS'
cycleInterval='20'/>
<
TimeSensor DEF='
Expl-TiS'
cycleInterval='0.5'/>
<
PositionInterpolator DEF='
Expl-PI'
key='0 1'
keyValue='1 1 1
2 2 2
'
/>
<
ROUTE fromNode='
Expl-TiS'
fromField='fraction_changed'
toNode='
Expl-PI'
toField='set_fraction'/>
<
ROUTE fromNode='
Expl-PI'
fromField='value_changed'
toNode='
Expl-Tf'
toField='scale'/>
<
ColorInterpolator DEF='
Expl-CI'
key='0 0.5 1'
keyValue='1 1 0.5
0.6 0 0
0.2 0 0
'
/>
<
ROUTE fromNode='
Expl-TiS'
fromField='fraction_changed'
toNode='
Expl-CI'
toField='set_fraction'/>
<
ROUTE fromNode='
Expl-CI'
fromField='value_changed'
toNode='
Expl-Mt'
toField='diffuseColor'/>
<
Transform DEF='
Console-Tf'>
<
Transform translation='0 -1.5 -5'>
<
Transform DEF='
Slider-Tf'>
<
Shape>
<
Appearance>
<Material diffuseColor='0 0.8 0'/>
</
Appearance>
<
Sphere radius='0.2'/>
</
Shape>
</
Transform>
<
Shape>
<
Appearance>
<Material diffuseColor='0.5 0 0'/>
</
Appearance>
<
Box size='2 0.1 0.1'/>
</
Shape>
<
PlaneSensor DEF='
Slider-PlS'
minPosition='-1 0'
maxPosition='1 0'/>
</
Transform>
<
Transform translation='1.5 -1.5 -5'
rotation='1 0 0 -1.5708'>
<
Shape>
<
Appearance>
<Material diffuseColor='1 0.5 0'/>
</
Appearance>
<
Cylinder radius='0.3'
height='0.1'/>
</
Shape>
<
TouchSensor DEF='
Button-ThS'/>
</
Transform>
<
Transform translation='-1.5 -1.7 -5'>
<
Shape>
<
Appearance>
<Material diffuseColor='1 1 0.999'/>
</
Appearance>
<
Text DEF='
Score-Tx'
string='"0"'
>
<
FontStyle size='0.5'
justify='"MIDDLE"'
/>
</
Text>
</
Shape>
</
Transform>
</
Transform>
<
ROUTE fromNode='
Slider-PlS'
fromField='translation_changed'
toNode='
Slider-Tf'
toField='translation'/>
<
ROUTE fromNode='
Button-ThS'
fromField='touchTime'
toNode='
Missile-TiS'
toField='startTime'/>
<
ProximitySensor DEF='
PrS'
size='1000 1000 1000'/>
<
ROUTE fromNode='
PrS'
fromField='position_changed'
toNode='
Console-Tf'
toField='set_translation'/>
<
ROUTE fromNode='
PrS'
fromField='orientation_changed'
toNode='
Console-Tf'
toField='set_rotation'/>
<
Script DEF='
Sc'>
<
field accessType='inputOnly'
type='
SFVec3f'
name='
set_translationPlS'/>
<
field accessType='inputOnly'
type='
SFFloat'
name='
set_fraction'/>
<
field accessType='inputOnly'
type='
SFBool'
name='
settingMissile'/>
<
field accessType='outputOnly'
type='
SFVec3f'
name='
missilePos'/>
<
field accessType='outputOnly'
type='
SFTime'
name='
stopTimeMissile'/>
<
field accessType='outputOnly'
type='
SFTime'
name='
startTimeExpl'/>
<
field accessType='outputOnly'
type='
SFInt32'
name='
whichChoice'/>
<
field accessType='outputOnly'
type='
MFString'
name='
scStr'/>
<
field accessType='outputOnly'
type='
SFColor'
name='
emiColorUfo'/>
<
field accessType='initializeOnly'
type='
SFNode'
name='
UFO'>
<Transform USE='UFO-Tf'/>
</
field>
<
field accessType='initializeOnly'
type='
MFNode'
name='
Meteos'>
<Transform USE='Meteo0-Tf'/>
<Transform USE='Meteo1-Tf'/>
<Transform USE='Meteo2-Tf'/>
</
field>
<
field accessType='initializeOnly'
type='
SFInt32'
name='
score'
value='0'/>
<
field accessType='initializeOnly'
type='
MFColor'
name='
ufoColors'
value='0 0 0
1 0 0
'
/>
<![CDATA[ecmascript:
function set_translationPlS (val) {
missilePos.x = val.x * 5;
}
function set_fraction (f,et) {
missilePos.z = f * -20;
if ( f >= 1 )
missilePos.z = 0;
if ( isHit(
missilePos,
UFO.translation ) ) {
stopTimeMissile = et;
startTimeExpl = et;
whichChoice = 1;
emiColorUfo = ufoColors[1];
score += 10;
scStr[0] = score;
}
for ( var i = 0; i <
Meteos.length; i++ ) {
if ( isHit(
missilePos,
Meteos[i].translation ) ) {
stopTimeMissile = et;
startTimeExpl = et;
whichChoice = 1;
}
}
}
function isHit (va,vb) {
return ( va.subtract(vb).length() <= 1.5 );
}
function settingMissile (val) {
if (!val) {
whichChoice = 0;
missilePos.z = 0;
emiColorUfo = ufoColors[0];
}
}
]]>
</
Script>
<
ROUTE fromNode='
Slider-PlS'
fromField='translation_changed'
toNode='
Sc'
toField='set_translationPlS'/>
<
ROUTE fromNode='
Missile-TiS'
fromField='fraction_changed'
toNode='
Sc'
toField='set_fraction'/>
<
ROUTE fromNode='
Expl-TiS'
fromField='isActive'
toNode='
Sc'
toField='settingMissile'/>
<
ROUTE fromNode='
Sc'
fromField='missilePos'
toNode='
Missile-Tf'
toField='translation'/>
<
ROUTE fromNode='
Sc'
fromField='stopTimeMissile'
toNode='
Missile-TiS'
toField='stopTime'/>
<
ROUTE fromNode='
Sc'
fromField='startTimeExpl'
toNode='
Expl-TiS'
toField='startTime'/>
<
ROUTE fromNode='
Sc'
fromField='whichChoice'
toNode='
Missile-Sw'
toField='whichChoice'/>
<
ROUTE fromNode='
Sc'
fromField='scStr'
toNode='
Score-Tx'
toField='string'/>
<
ROUTE fromNode='
Sc'
fromField='emiColorUfo'
toNode='
UFO-Mt0'
toField='emissiveColor'/>
<
ROUTE fromNode='
Sc'
fromField='emiColorUfo'
toNode='
UFO-Mt1'
toField='emissiveColor'/>