<?xml version="1.0" encoding="utf-8"?>
<ItemRenderer itemID="ITEM_ID_SNOW_MACHINE">
  <Data>
    <Sprite name="s_tile_sprite" fileName="game/tiles_page17.rttex" textureSize="32" frame="28,10" />
    <Sprite name="s_snow" fileName="game/particles12.rttex" textureSize="32" frame="24,7"/>

    <Animations>
      <SpriteAnimation name="a_snow" autoPlay="false" sprite="s_snow">
        <Frame>24,7</Frame>
        <Frame>25,7</Frame>
        <Frame>26,7</Frame>
        <Frame>27,7</Frame>
      </SpriteAnimation>
    </Animations>
    
    <StateMachines>
      <StateMachine name="IsOn">
        <States>
          <State name="False"/>
          <State name="True"/>
        </States>
        <Transitions>
          <Transition to="True" from="False">
            <Condition>
              <IsTileFlagActive operatorType="Equal">TILE_FLAG_IS_ON</IsTileFlagActive>
            </Condition>
          </Transition>

          <Transition to="False" from="True">
            <Condition>
              <IsTileFlagActive operatorType="NotEqual">TILE_FLAG_IS_ON</IsTileFlagActive>
            </Condition>
          </Transition>
        </Transitions>
      </StateMachine>
      <StateMachine name="Facing">
        <States>
          <State name="Left"/>
          <State name="Right"/>
        </States>
        <Transitions>
          <Transition to="Right" from="Left">
            <Condition>
              <IsFacingLeft>false</IsFacingLeft>
            </Condition>
          </Transition>

          <Transition to="Left" from="Right">
            <Condition>
              <IsFacingLeft>true</IsFacingLeft>
            </Condition>
          </Transition>
        </Transitions>
      </StateMachine>
    </StateMachines>

    <VariableMap>
      <Set name="tileColour">0, 0, 0</Set>
    </VariableMap>

    <ParticleSystems>
      <ParticleSystem name="snow_particle_right">
        <Emitter>
          <Set name="particlesPerEmission">1</Set>
          <Set name="infParticles">true</Set>
          <Set name="lifeTime">1</Set>
          <Set name="offset">6,-10</Set>
          <Random name="emissionInterval" min="0.01" max="0.1"/>
          <Set name="rgbTint" source="tileColour"/>
        </Emitter>
        <Particle randomSpriteFrame="true">
          <Set name="sprite">s_snow</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Set name="lifeTime">4</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 1</KeyFrame>
            <KeyFrame>0.95, 1</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Random name="initialVelocity" min="15, -30" max="85, -50" />
          <Curve name="finalVelocity">
            <KeyFrame>0, 0,40</KeyFrame>
            <KeyFrame>0.2, 0,40</KeyFrame>
            <KeyFrame>0.2, -20,40</KeyFrame>
            <KeyFrame>0.3, 20,40</KeyFrame>
            <KeyFrame>0.4, -20,40</KeyFrame>
            <KeyFrame>0.5, 20,40</KeyFrame>
            <KeyFrame>0.6, -20,40</KeyFrame>
            <KeyFrame>0.7, 20,40</KeyFrame>
            <KeyFrame>0.8, -20,40</KeyFrame>
            <KeyFrame>0.9, 20,40</KeyFrame>
            <KeyFrame>1, -20,40</KeyFrame>
          </Curve>
          <Set name="interpolateVelocity">true</Set>
          <Random name="initialRotationRate" min="-360" max="360" />
        </Particle>
      </ParticleSystem>
      <ParticleSystem name="snow_particle_left">
        <Emitter>
          <Set name="particlesPerEmission">1</Set>
          <Set name="infParticles">true</Set>
          <Set name="lifeTime">1</Set>
          <Set name="offset">6,-10</Set>
          <Random name="emissionInterval" min="0.01" max="0.1"/>
          <Set name="rgbTint" source="tileColour"/>
        </Emitter>
        <Particle randomSpriteFrame="true">
          <Set name="sprite">s_snow</Set>
          <Set name="blendingMode">PREMULTIPLIED_ALPHA</Set>
          <Set name="lifeTime">4</Set>
          <Curve name="initialAlpha">
            <KeyFrame>0, 0.8</KeyFrame>
            <KeyFrame>0.95, 0.8</KeyFrame>
            <KeyFrame>1, 0</KeyFrame>
          </Curve>
          <Random name="initialVelocity" min="-15, -30" max="-85, -50" />
          <Curve name="finalVelocity">
            <KeyFrame>0, 0,40</KeyFrame>
            <KeyFrame>0.2, 0,40</KeyFrame>
            <KeyFrame>0.2, -20,40</KeyFrame>
            <KeyFrame>0.3, 20,40</KeyFrame>
            <KeyFrame>0.4, -20,40</KeyFrame>
            <KeyFrame>0.5, 20,40</KeyFrame>
            <KeyFrame>0.6, -20,40</KeyFrame>
            <KeyFrame>0.7, 20,40</KeyFrame>
            <KeyFrame>0.8, -20,40</KeyFrame>
            <KeyFrame>0.9, 20,40</KeyFrame>
            <KeyFrame>1, -20,40</KeyFrame>
          </Curve>
          <Set name="interpolateVelocity">true</Set>
          <Random name="initialRotationRate" min="-360" max="360" />
        </Particle>
      </ParticleSystem>
    </ParticleSystems>
  </Data>
  <RenderRules>
    <Render>
      <SpriteRender name="s_tile_sprite" blend="PREMULTIPLIED_ALPHA" />
    </Render>
    <RenderInWorldSpaceFront>
      <Group onState="Facing.Right">
        <ParticleSystemUpdate name="snow_particle_right" onState="IsOn.True"/>
      </Group>
      <Group onState="Facing.Left">
        <ParticleSystemUpdate name="snow_particle_left" onState="IsOn.True"/>
      </Group>
    </RenderInWorldSpaceFront>
  </RenderRules>
</ItemRenderer>