示例#1
0
    public void InitCrawlCreators()
    {
        crawlCreators = new List <MonsterCrawlCreator>();

        int i;

        for (i = 0; i < allMonsters.Count; i++)
        {
            for (int j = 0; j < allMonsters[i].Count; j++)
            {
                MonsterInfo monsterInfo = allMonsters[i][j];
                if (monsterInfo.IsNull() == false && monsterInfo.config.monster_type == (int)MonsterType.crawl)
                {
                    if (monsterInfo.IsRoadCrawl())
                    {
                        MonsterCrawlCreator creator = new MonsterCrawlCreator();
                        creator.runId    = monsterInfo.runId;
                        creator.posX     = monsterInfo.posX;
                        creator.posY     = monsterInfo.posY;
                        creator.createId = monsterInfo.config.id;
                        creator.monster  = monsterInfo;
                        crawlCreators.Add(creator);
                    }
                }
            }
        }
    }
示例#2
0
    public List <MonsterInfo> CrawlCreate()
    {
        List <MonsterInfo> newMonster = new List <MonsterInfo>();

        for (int i = 0; i < crawlCreators.Count; i++)
        {
            MonsterCrawlCreator creator = crawlCreators[i];
            if (creator.monster == null)
            {
                CellInfo startCell = CellModel.Instance.GetCellByPos(creator.posX, creator.posY);

                if (!startCell.isBlank && startCell.config.cell_type == (int)CellType.terrain)
                {
                    continue;
                }

                MonsterInfo monster = new MonsterInfo();
                monster.configId = creator.createId;
                monster.SetConfig(monster.configId);
                monster.posX = creator.posX;
                monster.posY = creator.posY;
                allMonsters[creator.posY][creator.posX] = monster;
                creator.monster = monster;

                monster.InitReleaseList();
                startCell.SetConfig((int)monster.releaseList[0].id);
                monster.Hold();
                monster.InitRoadCrawl();

                newMonster.Add(monster);
            }
        }
        return(newMonster);
    }
示例#3
0
 public void ClearCrawlCreator(MonsterInfo monsterInfo)
 {
     for (int i = 0; i < crawlCreators.Count; i++)
     {
         MonsterCrawlCreator creator = crawlCreators[i];
         if (creator.monster != null && creator.monster == monsterInfo)
         {
             creator.monster = null;
             break;
         }
     }
 }