/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pesegato.MonkeySheet.extra;

import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.control.AbstractControl;
import com.pesegato.MonkeySheet.MSMaterialControl;

/**
 *
 * An example effect for having a sprite 'pulsate' with a color.
 * 
 * @author Pesegato
 */
public class PulseControl extends AbstractControl{

    MSMaterialControl ms;
    float pulseValue;
    final float speed=4;
    final float threshold=.5f;
    
    public PulseControl(MSMaterialControl ms){
        this.ms=ms;
    }
    boolean increasing=true;
    @Override
    protected void controlUpdate(float tpf) {
        if (increasing){
            pulseValue+=(speed*tpf);
            if (pulseValue>threshold)
                increasing=false;
        }
        else{
            pulseValue-=(speed*tpf);
            if (pulseValue<0)
                increasing=true;
        }
        ms.setFogIntensity(tpf);
    }

    @Override
    protected void controlRender(RenderManager rm, ViewPort vp) {
    }
    
}

@@ -467,17 +467,16 @@
 olor.%0A *
- 
 %0A * @aut
@@ -648,20 +648,16 @@
 ld=.5f;%0A
-    
 %0A    pub
@@ -1106,19 +1106,26 @@
 tensity(
-tpf
+pulseValue
 );%0A    %7D
@@ -1212,15 +1212,11 @@
 %7B%0A    %7D%0A
-    
 %0A%7D%0A

Fix PulseControl