Beispiel #1
0
    public static AIBaseData GetActorCurTarget(Actor actor, string name = "")
    {
        AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enBool);

        tmpData.SetBoolValue(actor.CurrentTargetIsDead);
        return(tmpData);
    }
Beispiel #2
0
    public static AIBaseData GetActorHPPercent(Actor actor, string name = "")
    {
        AIBaseData tmpData = AIBaseData.CreateAIBaseData();

        tmpData.SetFloatValue(actor.HP / actor.MaxHP);
        return(tmpData);
    }
Beispiel #3
0
    public static AIBaseData GetActorTargetDis(Actor actor, string name = "")
    {
        AIBaseData tmpData = AIBaseData.CreateAIBaseData();

        tmpData.SetFloatValue(ActorTargetManager.GetTargetDistance(actor.RealPos, actor.CurrentTarget.RealPos));
        return(tmpData);
    }
Beispiel #4
0
    public static AIBaseData GetActorIsInitAIDataList(Actor actor, string name = "")
    {
        AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enBool);

        tmpData.SetBoolValue(actor.IsInitAIDataList);
        return(tmpData);
    }
Beispiel #5
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);
    }
Beispiel #6
0
    public static AIBaseData GetTrapIsAble(Actor actor, string name = "")
    {
        Trap       tmpTrap = actor as Trap;
        AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enBool);

        tmpData.SetBoolValue(tmpTrap.m_trapAble);
        return(tmpData);
    }
Beispiel #7
0
    public static AIBaseData GetTrapState(Actor actor, string name = "")
    {
        Trap       tmpTrap = actor as Trap;
        AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enInt);

        tmpData.SetIntValue((int)tmpTrap.mTrapState);
        return(tmpData);
    }
Beispiel #8
0
    public static AIBaseData GetTrapMaxAttackCount(Actor actor, string name = "")
    {
        Trap       tmpTrap = actor as Trap;
        AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enInt);

        tmpData.SetIntValue(tmpTrap.mMaxAttackCount);
        return(tmpData);
    }
Beispiel #9
0
    public static AIBaseData GetTrapMinAttackTime(Actor actor, string name = "")
    {
        Trap       tmpTrap = actor as Trap;
        AIBaseData tmpData = AIBaseData.CreateAIBaseData();

        tmpData.SetFloatValue(tmpTrap.mMinAttackTime);
        return(tmpData);
    }
Beispiel #10
0
    public static AIBaseData GetTrapIsActorTouch(Actor actor, string name = "")
    {
        Trap       tmpTrap = actor as Trap;
        AIBaseData tmpData = AIBaseData.CreateAIBaseData(AIBaseData.DataType.enBool);

        tmpData.SetBoolValue(tmpTrap.mEnterActorIDList.Count > 0);
        return(tmpData);
    }
Beispiel #11
0
 public AIBaseData GetBaseData(string valueName, AIBaseData.DataType valueType)
 {
     if (m_baseDataDic.ContainsKey(valueName))
     {
         return(m_baseDataDic[valueName]);
     }
     else
     {
         AIBaseData tmpAIBaseData = AIBaseData.CreateAIBaseData(valueType);
         m_baseDataDic.Add(valueName, tmpAIBaseData);
         return(tmpAIBaseData);
     }
 }
Beispiel #12
0
    public override bool CompareValue(CompareType comType, AIBaseData compData)
    {
        switch (comType)
        {
        case CompareType.enHigh:
            return(mDataIntValue > compData.mDataIntValue);

        case CompareType.enLow:
            return(mDataIntValue < compData.mDataIntValue);

        case CompareType.enEqual:
            return(mDataIntValue == compData.mDataIntValue);
        }
        return(false);
    }
Beispiel #13
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"));
    }
Beispiel #14
0
    public override void SetValue(SetType setType, AIBaseData val)
    {
        switch (setType)
        {
        case SetType.enAdd:
            base.SetIntValue(val.mDataIntValue + mDataIntValue);
            break;

        case SetType.enSub:
            base.SetIntValue(val.mDataIntValue - mDataIntValue);
            break;

        case SetType.enReset:
            base.ResetValue();
            break;
        }
    }
Beispiel #15
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);
 }
Beispiel #16
0
    public override bool Exec(Actor actor)
    {
        bool       tmpBool  = false;
        AIBaseData sourData = null;
        AIBaseData tarData  = null;

        if (m_funcGetSourValue != null)
        {
            sourData = m_funcGetSourValue(actor, "");
        }
        if (m_funcGetTarValue != null)
        {
            tarData = m_funcGetTarValue(actor, "");
            tmpBool = sourData.CompareValue(mCompareType, tarData);
        }
        else
        {
            tmpBool = sourData.CompareValue(mCompareType, mValue);
        }
        return(tmpBool);
    }
Beispiel #17
0
 public static void SetActorIsInitAIDataList(Actor actor, AIBaseData val)
 {
     actor.IsInitAIDataList = val.GetValue_Bool();
 }
Beispiel #18
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"));
        }
    }
Beispiel #19
0
 public override void SetValue(AIBaseData val)
 {
     base.SetIntValue(val.mDataIntValue);
 }
Beispiel #20
0
 public override bool CompareValue(CompareType comType, AIBaseData compData)
 {
     return(mDataBoolValue == compData.mDataBoolValue);
 }
Beispiel #21
0
    public static AIBaseData GetAIData(Actor actor, string valueName)
    {
        AIBaseData aiData = actor.SelfAI.GetBaseData(valueName);

        return(aiData);
    }
Beispiel #22
0
 public override void SetValue(AIBaseData val)
 {
     base.SetBoolValue(val.mDataBoolValue);
 }
Beispiel #23
0
    public static void SetTrapMinAttackTime(Actor actor, AIBaseData val)
    {
        Trap tmpTrap = actor as Trap;

        tmpTrap.mMinAttackTime = val.GetValue_Float();
    }
Beispiel #24
0
 //数值比较
 public virtual bool CompareValue(CompareType comType, AIBaseData compData)
 {
     return(false);
 }
Beispiel #25
0
    public static void SetTrapMaxAttackCount(Actor actor, AIBaseData val)
    {
        Trap tmpTrap = actor as Trap;

        tmpTrap.mMaxAttackCount = val.GetValue_Int();
    }
Beispiel #26
0
 //按照设置类型设值
 public virtual void SetValue(SetType setType, AIBaseData val)
 {
 }
Beispiel #27
0
    public static void SetTrapState(Actor actor, AIBaseData val)
    {
        Trap tmpTrap = actor as Trap;

        tmpTrap.SetTrapState((Trap.TrapState)val.GetValue_Int());
    }
Beispiel #28
0
    public static void SetTrapIsAble(Actor actor, AIBaseData val)
    {
        Trap tmpTrap = actor as Trap;

        tmpTrap.m_trapAble = val.GetValue_Bool();
    }
Beispiel #29
0
 //直接赋值
 public virtual void SetValue(AIBaseData val)
 {
 }
Beispiel #30
0
 public static void SetActorHPValue(Actor actor, AIBaseData value)
 {
     actor.HP = value.GetValue_Float();
 }