For example I'd expect this code to have one green rectangle (the freshly spawned one) and if there are any other Models they should be fuchsia, but there are no green models after the first spawn is triggered:
Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
<OnLoaded>
<SpawnModel Model="Model2" Position="-4 0 0" UseSpawnerPosition="255"/>
</OnLoaded>
<Content>
<Model Name="Model2" Scale="0.25 0.25 1" Category="1">
<OnUpdate>
<Timer Interval="1" RepeatCount="0">
<OnTimer>
<ZExpression Expression="CurrentModel.Category = 2;"/>
<SpawnModel Model="Model2" Position="1 0 0" UseSpawnerPosition="255"/>
</OnTimer>
</Timer>
</OnUpdate>
<OnRender>
<Condition Comment="1 (green)" Expression="return(CurrentModel.Category == 1);">
<OnTrue>
<UseMaterial Material="Material1"/>
<RenderSetColor Color="0 1 0.251 1"/>
<RenderNet>
<RenderVertexExpression>
<![CDATA[//Update each vertex.
//Vertex : current vertex
//TexCoord : current texture coordinate
//Color : current vertex color
Vertex *=4;]]>
</RenderVertexExpression>
</RenderNet>
</OnTrue>
</Condition>
<Condition Comment="2 (fuchsia)" Expression="return(CurrentModel.Category == 2);">
<OnTrue>
<UseMaterial Material="Material1"/>
<RenderSetColor Color="1 0 0.502 1"/>
<RenderNet>
<RenderVertexExpression>
<![CDATA[//Update each vertex.
//Vertex : current vertex
//TexCoord : current texture coordinate
//Color : current vertex color
Vertex *=4;]]>
</RenderVertexExpression>
</RenderNet>
</OnTrue>
</Condition>
</OnRender>
</Model>
<Material Name="Material1" Shading="1" Light="0"/>
</Content>
</ZApplication>
Code: Select all
CurrentModel.Category = 1;