コード例 #1
0
    // 接口实现(ICloneable的接口)
    public virtual object Clone()
    {
        sdBehaviourEvent kBehaviourEvent = new sdBehaviourEvent();

        foreach (sdBehaviourTrigger kBehaviourTrigger in mBehaviourTriggerList)
        {
            kBehaviourEvent.AddBehaviourTrigger(kBehaviourTrigger.Clone() as sdBehaviourTrigger);
        }

        foreach (sdBehaviourAction kBehaviourAction in mBehaviourActionList)
        {
            kBehaviourEvent.AddBehaviourAction(kBehaviourAction.Clone() as sdBehaviourAction);
        }

        foreach (sdBehaviourState kBehaviourState in mBehaviourStateList)
        {
            kBehaviourEvent.AddBehaviourState(kBehaviourState.Clone() as sdBehaviourState);
        }

        kBehaviourEvent.ID                      = this.ID;
        kBehaviourEvent.MaxUseCount             = this.MaxUseCount;
        kBehaviourEvent.mBehaviourAdvancedState = this.mBehaviourAdvancedState;

        return(kBehaviourEvent);
    }
コード例 #2
0
ファイル: sdAITable.cs プロジェクト: tsinglee2009/Dczg
    // 加载事件aa
    protected sdBehaviourEvent LoadBehaviourEvent(XmlNode kXmlNode)
    {
        XmlElement kXmlElement = (XmlElement)kXmlNode;

        if (kXmlElement.Name != "AIEvent")
        {
            return(null);
        }

        sdBehaviourEvent kBehaviourEvent = new sdBehaviourEvent();

        kBehaviourEvent.ID          = int.Parse(kXmlElement.GetAttribute("id"));
        kBehaviourEvent.MaxUseCount = int.Parse(kXmlElement.GetAttribute("maxtickcount"));

        XmlNodeList kXmlChildNodeList = kXmlNode.ChildNodes;

        foreach (XmlNode kXmlChildNode in kXmlChildNodeList)
        {
            XmlElement kXmlChildElement = (XmlElement)kXmlChildNode;

            if (kXmlChildElement.Name == "AITrigger")
            {
                sdBehaviourTrigger kBehaviourTrigger = LoadBehaviourTrigger(kXmlChildNode);
                if (kBehaviourTrigger != null)
                {
                    kBehaviourEvent.AddBehaviourTrigger(kBehaviourTrigger);
                }
            }
            else if (kXmlChildElement.Name == "AIAction")
            {
                sdBehaviourAction kBehaviourAction = LoadBehaviourAction(kXmlChildNode);
                if (kBehaviourAction != null)
                {
                    kBehaviourEvent.AddBehaviourAction(kBehaviourAction);
                }
            }
            else if (kXmlChildElement.Name == "AIState")
            {
                sdBehaviourState kBehaviourState = LoadBehaviourState(kXmlChildNode);
                if (kBehaviourState != null)
                {
                    kBehaviourEvent.AddBehaviourState(kBehaviourState);
                }
            }
        }

        return(kBehaviourEvent);
    }