示例#1
0
    /// <summary>
    /// 按照刷新表动态刷新场景活动单元
    /// </summary>
    void RefreshCharacter()
    {
        while (true)
        {
            int refreshID = 100000 + ((int)mStageSystem.sceneID) * 10000 + mStageSystem.refreshIndex;
            CharacterRefreshPO characterRefreshPO = CharacterRefreshData.Instance.GetCharacterRefreshPO(refreshID);
            if (characterRefreshPO == null)
            {
                break;
            }
            if (characterRefreshPO.Stage != mLv)
            {
                break;
            }

            if (characterRefreshPO.AppeareTime > mStageTimer)
            {
                return;
            }

            CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(characterRefreshPO.CharacterID);
            if (characterRefreshPO.Loop == 1)
            {
                LoopRefresh lr = new LoopRefresh(characterRefreshPO.CharacterID, baseAttr.name, baseAttr.characterType, characterRefreshPO);
                mLoopList.Add(lr);
                ++mStageSystem.refreshIndex;
                continue;
            }

            E_CharacterType characterType = baseAttr.characterType;
            switch (characterType)
            {
            case E_CharacterType.Player:
                ISpawnCommand command = new SpawnCharacterCommand(baseAttr.id, characterRefreshPO);
                mCommands.Add(command);
                break;

            case E_CharacterType.Map:
                command = new SpawnMapCommand(baseAttr.id, characterRefreshPO);
                mCommands.Add(command);
                break;

            case E_CharacterType.Citizen0:
            case E_CharacterType.Citizen1:
            case E_CharacterType.Citizen2:
                command = new SpawnCitizenCommand(baseAttr.id, characterRefreshPO);
                mCommands.Add(command);
                break;

            case E_CharacterType.Npc:
                for (int i = 0; i < characterRefreshPO.StepCount; ++i)
                {
                    command = new SpawnNpcCommand(baseAttr.id, characterRefreshPO);
                    mCommands.Add(command);
                }
                break;

            case E_CharacterType.SandBox:
            case E_CharacterType.Bucket:
                command = new SpawnPropCommand(baseAttr.id, characterRefreshPO, Vector3.zero);
                mCommands.Add(command);
                break;

            case E_CharacterType.BullDemonKing:
                command = new SpawnBullDemonKingCommand(baseAttr.id, characterRefreshPO);
                mCommands.Add(command);
                break;

            case E_CharacterType.AngerBear:
                command = new SpawnBearCommand(baseAttr.id, characterRefreshPO);
                mCommands.Add(command);
                break;

            case E_CharacterType.Wolf:
                command = new SpawnWolfCommand(baseAttr.id, characterRefreshPO);
                mCommands.Add(command);
                break;
            }
            ++mStageSystem.refreshIndex;
        }
    }
示例#2
0
    /// <summary>
    /// 刷新指定怪物(循环刷新的怪物有大小火怪,烟雾怪,和精英怪)
    /// </summary>
    /// <param name="index"></param>
    private void SpawnCharacter(LoopRefresh lr)
    {
        #region 对ActionType单一的Character依据CharacterType刷新
        // 循环刷新金币
        if (lr.characterType == E_CharacterType.Coin)
        {
            ISpawnCommand command = new SpawnCoinCommand(lr.characterID, lr.characterRefreshPO);
            mCommands.Add(command);
            return;
        }

        // 循环刷新能劫持玩家的精英怪
        if (lr.characterType == E_CharacterType.Elite)
        {
            int count = ioo.characterSystem.GetNormalEliteMonsterCount();
            if (count < mEliteMonsterRefreshStrategy.GetMonsterCount(mLv))
            {
                ISpawnCommand command = new SpawnEliteMonsterCommand(lr.characterID, lr.characterRefreshPO);
                mCommands.Add(command);
            }
            return;
        }

        // 循环刷新能劫持玩家的狼
        if (lr.characterType == E_CharacterType.Wolf)
        {
            int count = ioo.characterSystem.GetWolfCount();
            if (count < mWolfRefreshStrategy.GetMonsterCount(mLv))
            {
                ISpawnCommand command = new SpawnWolfCommand(lr.characterID, lr.characterRefreshPO);
                mCommands.Add(command);
            }
        }
        #endregion

        #region 对ActionType多元的Character依据ActionType进行刷新
        E_ActionType type = (E_ActionType)lr.characterRefreshPO.ActionType;
        // 刷新攻击市民 和 npc
        if (ioo.characterSystem.CanSpawnSpecialHugeMonster())
        {
            if (type == E_ActionType.AttackCitizen || type == E_ActionType.AttackNpc)
            {
                switch (lr.characterType)
                {
                case E_CharacterType.HugeFireMonster:
                    ISpawnCommand command = new SpawnHugeFireMonsterCommand(lr.characterID, lr.characterRefreshPO);
                    mCommands.Add(command);
                    break;
                }
                return;
            }
        }


        // 等待直升机救援的市民
        if (type == E_ActionType.WaitForHelp)
        {
            ISpawnCommand command = new SpawnCitizenCommand(lr.characterID, lr.characterRefreshPO);
            mCommands.Add(command);
            return;
        }

        // 循环刷新攻击玩家的大小火怪和烟雾怪
        if (type == E_ActionType.Normal)
        {
            int count = ioo.characterSystem.GetNormalFlyMonsterCout();
            if (count < mFireMonsterRefreshStrategy.GetMonsterCount(mLv))
            {
                switch (lr.characterType)
                {
                case E_CharacterType.MiniFireMonster:
                case E_CharacterType.SmokeMonster:
                    ISpawnCommand command = new SpawnFireMonsterCommand(lr.characterID, lr.characterRefreshPO);
                    mCommands.Add(command);
                    break;

                case E_CharacterType.HugeFireMonster:
                    command = new SpawnHugeFireMonsterCommand(lr.characterID, lr.characterRefreshPO);
                    mCommands.Add(command);
                    break;
                }
            }
            return;
        }
        #endregion
    }