public static ICodeBehaviour AddBehaviour(this GameObject gameObject, StateMachine stateMachine)
        {
            ICodeBehaviour behaviour = gameObject.AddComponent <ICodeBehaviour> ();

            behaviour.stateMachine = stateMachine;
            behaviour.EnableStateMachine();
            return(behaviour);
        }
 public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (behaviour == null)
     {
         behaviour = animator.gameObject.AddBehaviour(stateMachine);
     }
     else
     {
         behaviour.EnableStateMachine();
         (behaviour.ActiveNode as State).Restart();
     }
 }
        public static ICodeBehaviour AddBehaviour(this GameObject gameObject, StateMachine stateMachine, int group, bool replaceIfExists)
        {
            ICodeBehaviour behaviour = gameObject.GetBehaviour(group);

            if (behaviour != null && replaceIfExists)
            {
                behaviour.stateMachine = stateMachine;
                behaviour.EnableStateMachine();
            }
            else
            {
                behaviour       = gameObject.AddBehaviour(stateMachine);
                behaviour.group = group;
            }
            return(behaviour);
        }
예제 #4
0
 public void Init(ICodeBehaviour component)
 {
     this.owner = component;
     this.Root.SetVariable("Owner", this.owner.gameObject);
     this.isInitialized = true;
 }
예제 #5
0
 public ComponentModel(ICodeBehaviour component, bool show)
 {
     this.component = component;
     this.show      = show;
 }