Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: ClintonReddie on October 02, 2015, 06:06:10 PM

Title: Update Emission GI
Post by: ClintonReddie on October 02, 2015, 06:06:10 PM
Here is an action to change emission global illumination.

Code: [Select]
// __ECO__PLAYMAKER__ACTION__

using UnityEngine;
using ParticlePlayground;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Lights")]
[Tooltip("Updates target emission GI.")]
public class UpdateEmissionGI : FsmStateAction
{
// the renderer that needs to update
public FsmGameObject target;
public FsmColor targetColor;
public bool everyFrame;

public override void Reset()
{
target = null;
targetColor = null;
}

public override void OnEnter()
{
DynamicGI.SetEmissive (target.Value.GetComponent<MeshRenderer>(), targetColor.Value);

if (!everyFrame)
{
Finish();
}
}

public override void OnUpdate()
{
DynamicGI.SetEmissive (target.Value.GetComponent<MeshRenderer>(), targetColor.Value);
}
}
}