playMaker

Author Topic: Update Emission GI  (Read 920 times)

ClintonReddie

  • Playmaker Newbie
  • *
  • Posts: 7
    • View Profile
Update Emission GI
« on: October 02, 2015, 03: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);
}
}
}