Пример #1
0
//     public void PushActorIDToList(int actorId)
//     {
//         mEnterActorIDList.Add(actorId);
//     }
//
//     public void PopActorIDToList(int actorId)
//     {
//         mEnterActorIDList.Remove(actorId);
//     }

    public bool CheckAttackAction()
    {
//         if (Self.mEnterActorIDList.Count <= 0)
//         {
//             return false;
//         }
        AIBaseData curAttackCount = GetBaseData("AttackCount", AIBaseData.DataType.enInt);

        if (Self.mMaxAttackCount > 0)
        {
            if (curAttackCount.GetValue_Float() > Self.mMaxAttackCount)
            {
                return(false);
            }
        }
        AIBaseData preAttackTime = GetBaseData("PreAttackTime", AIBaseData.DataType.enTime);

        if (Time.time - preAttackTime.GetValue_Float() < Self.mMinAttackTime)
        {
            return(false);
        }
        Self.TrapActive = true;
        if (OnAttackAction())
        {
            preAttackTime.ResetValue();
            curAttackCount.SetValue(curAttackCount.GetValue_Float() + 1);
        }
        return(false);
    }
Пример #2
0
 public override bool Exec(Actor actor)
 {
     if (m_funcGetValue != null)
     {
         AIBaseData actorData = m_funcGetValue(actor, "");
         mValue.SetValue(mSetType, actorData);
         m_funcSetValue(actor, mValue);
     }
     else
     {
         AIBaseData actorData = actor.SelfAI.GetBaseData(mValueName, mValueType);
         mValue.SetValue(mSetType, actorData);
         actorData.SetValue(mValue);
     }
     //FunctionalFuncBase.SetValue(actor, mObjType, mValueName, mValueType, mSetType, mValue);
     return(true);
 }
Пример #3
0
    public override void Deserialize(XmlNode xmlNode)
    {
        base.Deserialize(xmlNode);
        XmlElement xmlElement = xmlNode as XmlElement;

        mSourValueType     = xmlElement.GetAttribute("SourValueType");
        mSourValueName     = xmlElement.GetAttribute("SourValueName");
        m_funcGetSourValue = GetValueFunction(mSourValueType, mSourValueName);
        mTarValueType      = xmlElement.GetAttribute("TarValueType");
        mTarValueName      = xmlElement.GetAttribute("TarValueName");
        m_funcGetTarValue  = GetValueFunction(mTarValueType, mTarValueName);
        mValueType         = AIBaseData.ChangeStrToDataType(xmlElement.GetAttribute("ValueType"));
        mCompareType       = AIBaseData.ChangeStrToCompareType(xmlElement.GetAttribute("CompareType"));
        mValue             = AIBaseData.CreateAIBaseData(mValueType);
        mValue.SetValue(xmlElement.GetAttribute("Value"));
    }
Пример #4
0
    public override void Deserialize(XmlNode xmlNode)
    {
        base.Deserialize(xmlNode);
        XmlElement xmlElement = xmlNode as XmlElement;

        mObjType   = xmlElement.GetAttribute("ObjectType");
        mValueName = xmlElement.GetAttribute("ValueName");
        if (mObjType == "Actor")
        {
            switch (mValueName)
            {
            case "HP":
                m_funcGetValue = FunctionalFuncBase.GetActorHPValue;
                m_funcSetValue = FunctionalFuncBase.SetActorHPValue;
                break;

            case "IsInitAIDataList":
                m_funcGetValue = FunctionalFuncBase.GetActorIsInitAIDataList;
                m_funcSetValue = FunctionalFuncBase.SetActorIsInitAIDataList;
                break;

            case "TrapIsActive":
                m_funcGetValue = FunctionalFuncBase.GetTrapIsActive;
                m_funcSetValue = FunctionalFuncBase.SetTrapIsActive;
                break;

            case "TrapIsAble":
                m_funcGetValue = FunctionalFuncBase.GetTrapIsAble;
                m_funcSetValue = FunctionalFuncBase.SetTrapIsAble;
                break;

            case "TrapState":
                m_funcGetValue = FunctionalFuncBase.GetTrapState;
                m_funcSetValue = FunctionalFuncBase.SetTrapState;
                break;

            case "TrapMaxAttackCount":
                m_funcGetValue = FunctionalFuncBase.GetTrapMaxAttackCount;
                m_funcSetValue = FunctionalFuncBase.SetTrapMaxAttackCount;
                break;

            case "TrapMinAttackTime":
                m_funcGetValue = FunctionalFuncBase.GetTrapMinAttackTime;
                m_funcSetValue = FunctionalFuncBase.SetTrapMinAttackTime;
                break;

            default:
                break;
            }
        }
        else if (mObjType == "AI")
        {
            m_funcGetValue = null;
            m_funcSetValue = null;
        }
        mValueType = AIBaseData.ChangeStrToDataType(xmlElement.GetAttribute("ValueType"));
        mSetType   = AIBaseData.ChangeStrToSetType(xmlElement.GetAttribute("SetType"));
        mValue     = AIBaseData.CreateAIBaseData(mValueType);

        if (mSetType != AIBaseData.SetType.enReset)
        {
            mValue.SetValue(xmlElement.GetAttribute("Value"));
        }
    }