Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.74 KB | None | 0 0
  1. // (c) Copyright HutongGames, LLC 2010-2013. All rights reserved.
  2.  
  3. using UnityEngine;
  4.  
  5. namespace HutongGames.PlayMaker.Actions
  6. {
  7.     [ActionCategory(ActionCategory.GameObject)]
  8.     [Tooltip("Sets the value of a Material Variable.")]
  9.     public class SetMaterial : FsmStateAction
  10.     {
  11.         [RequiredField]
  12.         [UIHint(UIHint.Variable)]
  13.         public FsmMaterial variable;
  14.         public FsmMaterial material;
  15.         public bool everyFrame;
  16.  
  17.         public override void Reset()
  18.         {
  19.             variable = null;
  20.             material = null;
  21.             everyFrame = false;
  22.         }
  23.  
  24.         public override void OnEnter()
  25.         {
  26.             variable.Value = material.Value;
  27.            
  28.             if (!everyFrame)
  29.             {
  30.                 Finish();      
  31.             }
  32.         }
  33.  
  34.         public override void OnUpdate()
  35.         {
  36.             variable.Value = material.Value;
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement