コード例 #1
0
        public static ICodeBehaviour AddBehaviour(this GameObject gameObject, StateMachine stateMachine)
        {
            ICodeBehaviour behaviour = gameObject.AddComponent <ICodeBehaviour> ();

            behaviour.stateMachine = stateMachine;
            behaviour.EnableStateMachine();
            return(behaviour);
        }
コード例 #2
0
 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();
     }
 }
コード例 #3
0
        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;
 }