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

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

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

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