Пример #1
0
 public ActionBool(ActionBool actionBool, BComponent newParent = null)
 {
     this.parent          = newParent;
     this.actionName      = actionBool.actionName;
     this.componentName   = actionBool.componentName;
     this.action          = actionBool.action;
     this.behaviorManager = actionBool.behaviorManager;
 }
Пример #2
0
        public static BComponent Build(XmlNode xmlDoc, BComponent parent, Behaviors behaviorManager)
        {
            System.Func <bool> action = null;
            string             actionName;
            string             componentName;
            bool   isError      = false;
            string messageError = "";

            FindAttributes(xmlDoc, out actionName, out componentName);

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

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

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