コード例 #1
0
    private bool SetupAngryStartAction()
    {
        if (m_angryDataList == null || m_angryDataList.Count <= 0)
        {
            return(false);
        }
        int count = m_angryDataList.Count;

        if (count <= 0)
        {
            return(false);
        }
        m_execAngryIdList.Clear();
        int num = -1;

        for (int i = 0; i < count; i++)
        {
            EnemyAngryTable.Data angryData = m_angryDataList[i];
            if (angryData == null)
            {
                Log.Error("angryData is null!! idx:{0}", i);
            }
            else if (!enemy.CheckAngryID(angryData.id))
            {
                bool flag = false;
                switch (angryData.condition)
                {
                case ANGRY_CONDITION.LESS_HP:
                {
                    float num2 = (float)enemy.hp / (float)enemy.hpMax;
                    float num3 = (float)angryData.value1 / 100f;
                    if (num2 <= num3)
                    {
                        flag = true;
                    }
                    break;
                }

                case ANGRY_CONDITION.NUM_DOWN:
                    if (enemy.downCount >= angryData.value1)
                    {
                        flag = true;
                    }
                    break;

                case ANGRY_CONDITION.BREAK_PARTS:
                {
                    EnemyRegionWork enemyRegionWork = enemy.SearchRegionWork(angryData.value1);
                    if (enemyRegionWork != null && (int)enemyRegionWork.hp <= 0)
                    {
                        flag = true;
                    }
                    break;
                }
                }
                if (flag)
                {
                    num = actions.FindIndex((ActionInfo action) => action.data.actionID == angryData.actionID);
                    m_execAngryIdList.Add(angryData.id);
                }
            }
        }
        if (num < 0)
        {
            return(false);
        }
        foreach (uint execAngryId in m_execAngryIdList)
        {
            enemy.RegisterAngryID(execAngryId);
        }
        oldIndex    = nowIndex;
        nowIndex    = num;
        totalWeight = 1;
        return(true);
    }
コード例 #2
0
    private void PrepareActionInfoList(List <EnemyActionTable.EnemyActionData> actionDataList, int nextActionID)
    {
        if (m_nowActionID != nextActionID)
        {
            actions         = new List <ActionInfo>();
            m_angryDataList = new List <EnemyAngryTable.Data>();
            m_nowActionID   = nextActionID;
            actionDataList.ForEach(delegate(EnemyActionTable.EnemyActionData data)
            {
                ActionInfo actionInfo = new ActionInfo
                {
                    data = data
                };
                int num = data.regionFlags.Length;
                for (int i = 0; i < num; i++)
                {
                    EnemyActionTable.EnemyActionData.RegionFlag regionFlag = data.regionFlags[i];
                    if (regionFlag.name.Length > 0)
                    {
                        int regionID = enemy.GetRegionID(regionFlag.name);
                        if (regionID > 0)
                        {
                            switch (regionFlag.flag)
                            {
                            case 0:
                                actionInfo.useDeadRegionIDs.Add(regionID);
                                break;

                            case 1:
                                actionInfo.useAliveRegionIDs.Add(regionID);
                                break;

                            case 2:
                                actionInfo.useReviveRegionIDs.Add(regionID);
                                break;
                            }
                        }
                    }
                }
                EnemyActionTable.ActionTypeInfo[] combiActionTypeInfos = actionInfo.data.combiActionTypeInfos;
                if (combiActionTypeInfos != null && combiActionTypeInfos.Length > 0)
                {
                    int num2 = combiActionTypeInfos.Length;
                    for (int j = 0; j < num2; j++)
                    {
                        EnemyActionTable.ACTION_TYPE type = combiActionTypeInfos[j].type;
                        if (type == EnemyActionTable.ACTION_TYPE.ANGRY)
                        {
                            uint angryId = actionInfo.data.angryId;
                            if (Singleton <EnemyAngryTable> .IsValid() && angryId != 0)
                            {
                                EnemyAngryTable.Data data2 = Singleton <EnemyAngryTable> .I.GetData(angryId);
                                if (data2 != null)
                                {
                                    data2.actionID = actionInfo.data.actionID;
                                    m_angryDataList.Add(data2);
                                }
                            }
                            actionInfo.data.isUse = false;
                        }
                    }
                }
                if (data.startWaitInterval > 0f)
                {
                    data.startWaitTime = Time.get_time();
                }
                if ((int)m_enemyData.level >= data.useLvLimit)
                {
                    actions.Add(actionInfo);
                }
            });
        }
    }