コード例 #1
0
        private unsafe static IntPtr GetEnemySpawnDataPatch(IntPtr thisPtr, Vector3 *position, IntPtr courseNode,
                                                            EnemyGroupType groupType, eEnemyGroupSpawnType spawnType, uint persistentGameDataID,
                                                            float populationScore, IntPtr targetReplicator, IntPtr survivalWave,
                                                            uint debugEnemyID, AgentMode debugEnemyMode)
        {
            var result = ourGetEnemySpawnData(thisPtr, position, courseNode, groupType, spawnType, persistentGameDataID, populationScore * SpawnTweakSettings.spawnPopMult, targetReplicator, survivalWave, debugEnemyID, debugEnemyMode);

            return(result);
        }
コード例 #2
0
    private IEnumerator Game()
    {
        yield return(new WaitForSeconds(startDelay));

        int levelIndex = 0;

        while (sendEnemies)
        {
            if (generateInfiniteLevel)
            {
                // Select what group to spawn at random
                int index = Random.Range(0, groupTypes.Types.Length);
                yield return(StartCoroutine(SpawnGroup(groupTypes.Types[index])));

                yield return(new WaitForSeconds(outerDelayIfGenerated));
            }
            else if (levelIndex < level.Length)
            {
                // Spawn group next group in level
                EnemyGroupType groupType = groupTypes.GetGroupByName(level[levelIndex].Name);
                yield return(StartCoroutine(SpawnGroup(groupType)));

                yield return(new WaitForSeconds(level[levelIndex].DelayAfter));

                ++levelIndex;
            }
            else
            {
                // TODO

                while (GameObject.FindObjectsOfType <AbstractEnemy>().Length != 0)
                {
                    yield return(new WaitForSeconds(1f));
                }

                Debug.Log("You just beat this level!");
                StartCoroutine(LevelTransitionRoutine());


                break;
            }
        }
    }
コード例 #3
0
    private IEnumerator SpawnGroup(EnemyGroupType group)
    {
        if (group.IsRandom)
        {
            for (int n = 0; n < group.AmountIfRandom; ++n)
            {
                // Select on of the group at random
                int index = Random.Range(0, group.Enemies.Length);
                yield return(StartCoroutine(SpawnSingle(group.Enemies[index])));

                yield return(new WaitForSeconds(group.InnerDelay));
            }
        }
        else
        {
            // Spawn in sequence
            foreach (AbstractEnemy e in group.Enemies)
            {
                yield return(StartCoroutine(SpawnSingle(e)));

                yield return(new WaitForSeconds(group.InnerDelay));
            }
        }
    }