Ejemplo n.º 1
0
 public ActionEnumerator(ActionEnumerator actionEnum, BComponent newParent = null)
 {
     this.parent          = newParent;
     this.actionName      = actionEnum.actionName;
     this.componentName   = actionEnum.componentName;
     this.action          = actionEnum.action;
     this.enumerator      = this.action();
     this.behaviorManager = actionEnum.behaviorManager;
 }
Ejemplo n.º 2
0
        public static BComponent Build(XmlNode xmlDoc, BComponent parent, Behaviors behaviorManager)
        {
            System.Func <IEnumerator <bool> > action = null;
            string actionName;
            string componentName;
            bool   isError      = false;
            string messageError = "";

            FindAttributes(xmlDoc, out actionName, out componentName);

            if (actionName == null)
            {
                isError      = true;
                messageError = "ActionEnumerator: don't have action attribute";
                throw new NullReferenceException(messageError);
            }
            else
            {
                MonoBehaviour mono = GetRightMono(componentName, behaviorManager.components);
                if (mono != null)
                {
                    action = FindMethod <System.Func <IEnumerator <bool> > >(actionName, mono);
                }
                else
                {
                    isError      = true;
                    messageError = string.Format("ActionEnumerator: wrong component name [{1}] for menthod: [{0}]", actionName, componentName);
                    Debug.LogError(messageError);
                }
            }

            ActionEnumerator result = new ActionEnumerator(parent, action, actionName, componentName, behaviorManager);

            result.isError      = isError;
            result.messageError = messageError;
            return(result);
        }