Exemplo n.º 1
0
    static IEnumerator update(EntryHolder entries, SpawnInfo spawnInfo)
    {
        spawnInfo.group.spawns.notifyBegin();


        SpawnState state = new SpawnState();

        state.totalWeight = entries.sumWeight();


        for (state.spawned = 0; state.spawned < spawnInfo.targetMemberCount; state.spawned++)
        {
            do
            {
                yield return(new WaitForSeconds(spawnInfo.intervalTime));

                // グループ内に空きがなければ回り続ける
            }while(spawnInfo.group.memberCount >= spawnInfo.group.maxStayCapacity);


            var ent = spawnInfo.getEntry(ref state, ref spawnInfo, ref entries);

            var act = spawnInfo.spawn(ent.definition, ref state, ref spawnInfo);

            act.character = ent.ch;

            spawnInfo.group.enter(act);
        }


        spawnInfo.group.spawns.notifyEnd();
    }