Skip to content

Instantly share code, notes, and snippets.

@ashblue
Created July 16, 2015 01:32
Show Gist options
  • Save ashblue/437b313ad3bfd9d8267d to your computer and use it in GitHub Desktop.
Save ashblue/437b313ad3bfd9d8267d to your computer and use it in GitHub Desktop.
PlayMaker library action. Randomly choose a color between two colors.
using UnityEngine;
namespace HutongGames.PlayMaker.Actions {
[ActionCategory(ActionCategory.Color)]
[Tooltip("Select a random Color between two Colors.")]
public class RandomBetweenColors : FsmStateAction {
public FsmColor color1;
public FsmColor color2;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmColor storeColor;
public override void Reset () {
color1 = new FsmColor();
color2 = new FsmColor();
storeColor = null;
}
public override void OnEnter () {
storeColor.Value = Color.Lerp(color1.Value, color2.Value, Random.Range(0f, 1f));
Finish();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment