Exemple #1
0
    // 接口实现(ICloneable的接口)
    public override object Clone()
    {
        sdManualBuffBehaviourState kManualBuffBehaviourState = new sdManualBuffBehaviourState();

        kManualBuffBehaviourState.mTimeStamp = this.mTimeStamp;
        kManualBuffBehaviourState.mBehaviourAdvancedState = this.mBehaviourAdvancedState;

        kManualBuffBehaviourState.mBuffID    = this.mBuffID;
        kManualBuffBehaviourState.mDelayTime = this.mDelayTime;

        return(kManualBuffBehaviourState);
    }
Exemple #2
0
    // 加载状态aa
    protected sdBehaviourState LoadBehaviourState(XmlNode kXmlNode)
    {
        XmlElement kXmlElement = (XmlElement)kXmlNode;

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

        sdBehaviourState kBehaviourState = null;
        int iID = int.Parse(kXmlElement.GetAttribute("id"));

        if (iID == (int)EBehaviourStateType.enBST_Summon)
        {
            sdSummonBehaviourState kSummonBehaviourState = new sdSummonBehaviourState();
            kSummonBehaviourState.DelayTime     = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kSummonBehaviourState.Count         = int.Parse(kXmlElement.GetAttribute("param2"));
            kSummonBehaviourState.IntervalTime  = int.Parse(kXmlElement.GetAttribute("param3")) / 1000.0f;
            kSummonBehaviourState.LevelAreaName = kXmlElement.GetAttribute("param4") as string;

            kBehaviourState = kSummonBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_Skill)
        {
            sdSkillBehaviourState kSkillBehaviourState = new sdSkillBehaviourState();
            kSkillBehaviourState.DelayTime           = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kSkillBehaviourState.Count               = int.Parse(kXmlElement.GetAttribute("param2"));
            kSkillBehaviourState.IntervalTime        = int.Parse(kXmlElement.GetAttribute("param3")) / 1000.0f;
            kSkillBehaviourState.SkillGroupProbility = int.Parse(kXmlElement.GetAttribute("param4")) / 10000.0f;

            string   kSkilllIDGroup        = kXmlElement.GetAttribute("param5") as string;
            string   kSkilllProbilityGroup = kXmlElement.GetAttribute("param6") as string;
            string[] kSkilllIDArray        = kSkilllIDGroup.Split(';');
            string[] kSkilllProbilityArray = kSkilllProbilityGroup.Split(';');

            for (int i = 0; i < kSkilllIDArray.Length; ++i)
            {
                int   iSkillID        = int.Parse(kSkilllIDArray[i]);
                float fSkillProbility = int.Parse(kSkilllProbilityArray[i]) / 10000.0f;

                kSkillBehaviourState.AddSkill(iSkillID, fSkillProbility);
            }

            if (kXmlElement.HasAttribute("param7"))
            {
                string kDetectDistance = kXmlElement.GetAttribute("param7") as string;
                if (kDetectDistance != null)
                {
                    kSkillBehaviourState.DetectDistance = (int.Parse(kDetectDistance) != 0);
                }
            }

            kBehaviourState = kSkillBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_Buff)
        {
            sdBuffBehaviourState kBuffBehaviourState = new sdBuffBehaviourState();
            kBuffBehaviourState.DelayTime    = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kBuffBehaviourState.Count        = int.Parse(kXmlElement.GetAttribute("param2"));
            kBuffBehaviourState.IntervalTime = int.Parse(kXmlElement.GetAttribute("param3")) / 1000.0f;
            kBuffBehaviourState.BuffID       = int.Parse(kXmlElement.GetAttribute("param4"));
            kBuffBehaviourState.BuffBehaviourActionTargetType = (EBuffBehaviourActionTargetType)(int.Parse(kXmlElement.GetAttribute("param5")));

            if (kXmlElement.HasAttribute("param6"))
            {
                string kBuffProbility = kXmlElement.GetAttribute("param6") as string;
                if (kBuffProbility != null)
                {
                    kBuffBehaviourState.BuffProbility = int.Parse(kBuffProbility) / 10000.0f;
                }
            }

            kBehaviourState = kBuffBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_CD_Skill)
        {
            sdCDSkillBehaviourState kCDSkillBehaviourState = new sdCDSkillBehaviourState();
            kCDSkillBehaviourState.DelayTime = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kCDSkillBehaviourState.SkillID   = int.Parse(kXmlElement.GetAttribute("param2"));

            kBehaviourState = kCDSkillBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_Disable_Skill)
        {
            sdDisableSkillBehaviourState kDisableSkillBehaviourState = new sdDisableSkillBehaviourState();
            kDisableSkillBehaviourState.DelayTime = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kDisableSkillBehaviourState.SkillID   = int.Parse(kXmlElement.GetAttribute("param2"));

            kBehaviourState = kDisableSkillBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_Disable_Mesh)
        {
            sdDisableMeshBehaviourState kDisableMeshBehaviourState = new sdDisableMeshBehaviourState();
            kDisableMeshBehaviourState.DelayTime = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kDisableMeshBehaviourState.MeshName  = kXmlElement.GetAttribute("param2") as string;

            kBehaviourState = kDisableMeshBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_Force_Animation)
        {
            sdAnimationBehaviourState kAnimationBehaviourState = new sdAnimationBehaviourState();
            kAnimationBehaviourState.DelayTime     = int.Parse(kXmlElement.GetAttribute("param1"));         /// 1000.0f;
            kAnimationBehaviourState.AnimationName = kXmlElement.GetAttribute("param2") as string;

            kBehaviourState = kAnimationBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_Change_Layer)
        {
            sdChangeLayerBehaviourState kChangeLayerBehaviourState = new sdChangeLayerBehaviourState();
            kChangeLayerBehaviourState.DelayTime = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kChangeLayerBehaviourState.LayerName = kXmlElement.GetAttribute("param2") as string;

            kBehaviourState = kChangeLayerBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_Hide)
        {
            sdHideBehaviourState kHideBehaviourState = new sdHideBehaviourState();
            kHideBehaviourState.DelayTime = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;

            kBehaviourState = kHideBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_Manual_Buff)
        {
            sdManualBuffBehaviourState kManualBuffBehaviourState = new sdManualBuffBehaviourState();
            kManualBuffBehaviourState.DelayTime = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kManualBuffBehaviourState.BuffID    = int.Parse(kXmlElement.GetAttribute("param2"));

            kBehaviourState = kManualBuffBehaviourState;
        }
        else if (iID == (int)EBehaviourStateType.enBST_Change_BattleDistance)
        {
            sdChangeBattleDistanceBehaviourState kChangeBattleDistanceBehaviourState = new sdChangeBattleDistanceBehaviourState();
            kChangeBattleDistanceBehaviourState.DelayTime      = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kChangeBattleDistanceBehaviourState.BattleDistance = int.Parse(kXmlElement.GetAttribute("param2")) / 1000.0f;

            kBehaviourState = kChangeBattleDistanceBehaviourState;
        }

        return(kBehaviourState);
    }