Beispiel #1
0
        public void parseXml(XmlElement elem)
        {
            m_layerList.Clear();

            XmlNodeList layersNodeList = elem.SelectNodes("Layer");
            XmlElement layerElem = null;
            XmlLayer layer;
            foreach (XmlNode layerNode in layersNodeList)
            {
                layerElem = (XmlElement)layerNode;
                layer = new XmlLayer();
                m_layerList.Add(layer);
                layer.xmlLayers = this;
                layer.parseXml(layerElem);
            }
        }
Beispiel #2
0
        // 添加状态机之间的转换
        static public void BuildStateMachineTransition(XmlLayer xmlLayer)
        {
            XmlStateMachine xmlSrcStateMachine  = null;
            XmlStateMachine xmlDestStateMachine = null;
            XmlState        xmlDestState        = null;

            foreach (var stateMachineTransition in xmlLayer.xmlStateMachineTransitionList)
            {
                xmlSrcStateMachine  = xmlLayer.getXmlStateMachineByName(stateMachineTransition.srcStateMachineName);
                xmlDestStateMachine = xmlLayer.getXmlStateMachineByName(stateMachineTransition.destStateMachineName);
                xmlDestState        = xmlDestStateMachine.getXmlStateByName(stateMachineTransition.destStateName);

                stateMachineTransition.animatorTransition = xmlSrcStateMachine.animatorStateMachine.AddStateMachineTransition(xmlDestStateMachine.animatorStateMachine, xmlDestState.animatorState);
                //stateMachineTransition.animatorTransition = xmlDestStateMachine.animatorStateMachine.AddStateMachineTransition(xmlSrcStateMachine.animatorStateMachine, xmlDestState.animatorState);
            }
        }
Beispiel #3
0
        public void parseXml(XmlElement elem)
        {
            m_layerList.Clear();

            XmlNodeList layersNodeList = elem.SelectNodes("Layer");
            XmlElement  layerElem      = null;
            XmlLayer    layer;

            foreach (XmlNode layerNode in layersNodeList)
            {
                layerElem = (XmlElement)layerNode;
                layer     = new XmlLayer();
                m_layerList.Add(layer);
                layer.xmlLayers = this;
                layer.parseXml(layerElem);
            }
        }
Beispiel #4
0
        static public void BuildAnimationStateLayer(XmlLayer xmlLayer)
        {
            int stateMachineIdx = 0;
            AnimatorStateMachine stateMachine = null;

            for (stateMachineIdx = 0; stateMachineIdx < xmlLayer.stateMachineList.Count; ++stateMachineIdx)
            {
                // 获取当前状态机
                if (0 == stateMachineIdx)        // 系统默认创建一个主动画状态机,自状态机需要自己创建
                {
                    stateMachine = xmlLayer.animatorControllerLayer.stateMachine;
                    xmlLayer.stateMachineList[stateMachineIdx].animatorStateMachine = stateMachine;
                    stateMachine.name = xmlLayer.stateMachineList[stateMachineIdx].name;
                }
                else    // 自状态机需要从主状态机创建
                {
                    xmlLayer.stateMachineList[stateMachineIdx].animatorStateMachine = xmlLayer.stateMachineList[0].animatorStateMachine.AddStateMachine(xmlLayer.stateMachineList[stateMachineIdx].name, xmlLayer.stateMachineList[stateMachineIdx].pos);
                }

                BuildAnimationStateMachine(xmlLayer.stateMachineList[stateMachineIdx]);
                BuildStateTransition(xmlLayer.stateMachineList[stateMachineIdx]);
            }
        }