Exemplo n.º 1
0
    // 接口实现(ICloneable的接口)aa
    public override object Clone()
    {
        sdBattleBehaviourTriggerState kBattleBehaviourTriggerState = new sdBattleBehaviourTriggerState();

        kBattleBehaviourTriggerState.mBTUType = this.mBTUType;

        return(kBattleBehaviourTriggerState);
    }
Exemplo n.º 2
0
    // 加载触发aa
    protected sdBehaviourTrigger LoadBehaviourTrigger(XmlNode kXmlNode)
    {
        XmlElement kXmlElement = (XmlElement)kXmlNode;

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

        sdBehaviourTrigger kBehaviourTrigger = null;
        int iID    = int.Parse(kXmlElement.GetAttribute("id"));
        int iUsage = int.Parse(kXmlElement.GetAttribute("usage"));

        if (iID == (int)EBehaviourTriggerType.enBTT_LiveState)
        {
            kBehaviourTrigger         = new sdLiveBehaviourTriggerState();
            kBehaviourTrigger.BTUType = (EBehaviourTriggerUsageType)iUsage;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_BattleState)
        {
            kBehaviourTrigger         = new sdBattleBehaviourTriggerState();
            kBehaviourTrigger.BTUType = (EBehaviourTriggerUsageType)iUsage;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_HPState)
        {
            sdHPBehaviourTriggerState kHPBehaviourTriggerState = new sdHPBehaviourTriggerState();
            kHPBehaviourTriggerState.BTUType             = (EBehaviourTriggerUsageType)iUsage;
            kHPBehaviourTriggerState.MinConditionPercent = int.Parse(kXmlElement.GetAttribute("param1")) / 10000.0f;
            kHPBehaviourTriggerState.MaxConditionPercent = int.Parse(kXmlElement.GetAttribute("param2")) / 10000.0f;

            kBehaviourTrigger = kHPBehaviourTriggerState;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_IdleState)
        {
            kBehaviourTrigger         = new sdIdleBehaviourTriggerState();
            kBehaviourTrigger.BTUType = (EBehaviourTriggerUsageType)iUsage;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_TimeState)
        {
            sdTimeBehaviourTriggerState kTimeBehaviourTriggerState = new sdTimeBehaviourTriggerState();
            kTimeBehaviourTriggerState.BTUType      = (EBehaviourTriggerUsageType)iUsage;
            kTimeBehaviourTriggerState.DelayTime    = int.Parse(kXmlElement.GetAttribute("param1")) / 1000.0f;
            kTimeBehaviourTriggerState.IntervalTime = int.Parse(kXmlElement.GetAttribute("param2")) / 1000.0f;
            kTimeBehaviourTriggerState.ElapseTime   = int.Parse(kXmlElement.GetAttribute("param3")) / 1000.0f;

            kBehaviourTrigger = kTimeBehaviourTriggerState;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_Summoned)
        {
            kBehaviourTrigger         = new sdSummonedBehaviourTrigger();
            kBehaviourTrigger.BTUType = (EBehaviourTriggerUsageType)iUsage;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_Killed)
        {
            kBehaviourTrigger         = new sdKilledBehaviourTrigger();
            kBehaviourTrigger.BTUType = (EBehaviourTriggerUsageType)iUsage;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_ChangeTarget)
        {
            kBehaviourTrigger         = new sdChangeTargetBehaviourTrigger();
            kBehaviourTrigger.BTUType = (EBehaviourTriggerUsageType)iUsage;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_HP)
        {
            sdHPBehaviourTrigger kHPBehaviourTrigger = new sdHPBehaviourTrigger();
            kHPBehaviourTrigger.BTUType          = (EBehaviourTriggerUsageType)iUsage;
            kHPBehaviourTrigger.BHPBTCType       = (EHPBehaviourTriggerCompareType)(int.Parse(kXmlElement.GetAttribute("param1")));
            kHPBehaviourTrigger.ConditionPercent = int.Parse(kXmlElement.GetAttribute("param2")) / 10000.0f;

            kBehaviourTrigger = kHPBehaviourTrigger;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_HurtHP)
        {
            sdHurtHPBehaviourTrigger kHurtHPBehaviourTrigger = new sdHurtHPBehaviourTrigger();
            kHurtHPBehaviourTrigger.BTUType          = (EBehaviourTriggerUsageType)iUsage;
            kHurtHPBehaviourTrigger.ConditionPercent = int.Parse(kXmlElement.GetAttribute("param1")) / 10000.0f;

            kBehaviourTrigger = kHurtHPBehaviourTrigger;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_AccumHurtHP)
        {
            sdAccumHurtHPBehaviourTrigger kAccumHurtHPBehaviourTrigger = new sdAccumHurtHPBehaviourTrigger();
            kAccumHurtHPBehaviourTrigger.BTUType          = (EBehaviourTriggerUsageType)iUsage;
            kAccumHurtHPBehaviourTrigger.ConditionPercent = int.Parse(kXmlElement.GetAttribute("param1")) / 10000.0f;

            kBehaviourTrigger = kAccumHurtHPBehaviourTrigger;
        }
        else if (iID == (int)EBehaviourTriggerType.enBTT_Buff)
        {
            sdBuffBehaviourTrigger kBuffBehaviourTrigger = new sdBuffBehaviourTrigger();
            kBuffBehaviourTrigger.BTUType   = (EBehaviourTriggerUsageType)iUsage;
            kBuffBehaviourTrigger.BuffState = (HeaderProto.ECreatureActionState)(int.Parse(kXmlElement.GetAttribute("param1")));

            kBehaviourTrigger = kBuffBehaviourTrigger;
        }

        return(kBehaviourTrigger);
    }