Created
July 16, 2015 01:32
-
-
Save ashblue/437b313ad3bfd9d8267d to your computer and use it in GitHub Desktop.
PlayMaker library action. Randomly choose a color between two colors.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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