Example #1
0
    private void spawnThing(ThingToSpawn subject)
    {
        GameObject newObj     = GameObject.Instantiate(subject.prefab, subject.position, new Quaternion(0, 0, 0, 0));
        _Vampire   spawnClass = newObj.GetComponent <_Vampire>();

        spawnClass.initialize(subject.waypoints, subject.dif);
    }
Example #2
0
    private void Start()
    {
        // the scene spawn data is saved like this instead of serialized since unity serialization has a habit of losing your data and i am not setting this up multiple times.
        // the data is serialized however so you can still see it ineditor, ingame.
        ThingToSpawn[] level1Spawner = new ThingToSpawn[3] {
            new ThingToSpawn(vampirePrefab, SpawnPoints[0].transform.position, new Vector3[1] {
                allLocations[0].transform.position
            }, 0, ThingToSpawn.difficulty.easy),
            new ThingToSpawn(vampirePrefab, SpawnPoints[1].transform.position, new Vector3[1] {
                allLocations[0].transform.position
            }, 3, ThingToSpawn.difficulty.easy),
            new ThingToSpawn(vampirePrefab, SpawnPoints[2].transform.position, new Vector3[1] {
                allLocations[0].transform.position
            }, 5, ThingToSpawn.difficulty.easy)
        };

        ThingToSpawn[] level2Spawner = new ThingToSpawn[4] {
            new ThingToSpawn(vampirePrefab, SpawnPoints[3].transform.position, new Vector3[1] {
                allLocations[1].transform.position
            }, 0, ThingToSpawn.difficulty.med),
            new ThingToSpawn(vampirePrefab, SpawnPoints[4].transform.position, new Vector3[1] {
                allLocations[1].transform.position
            }, 3, ThingToSpawn.difficulty.med),
            new ThingToSpawn(vampirePrefab, SpawnPoints[5].transform.position, new Vector3[1] {
                allLocations[1].transform.position
            }, 5, ThingToSpawn.difficulty.med),
            new ThingToSpawn(vampirePrefab, SpawnPoints[6].transform.position, new Vector3[1] {
                allLocations[1].transform.position
            }, 5, ThingToSpawn.difficulty.med)
        };

        allLevels = new Level[2] {
            new Level(0, 3, allLocations[0], level1Spawner, levelLights[0]),
            new Level(1, 4, allLocations[1], level2Spawner, null)
        };

        currentLevel = allLevels[0];
        Debug.Log(GlobalVariables.Instance);
        GlobalVariables.Instance.aiSpawner.InitializeLevelAIs(currentLevel.allCreeps);
    }
Example #3
0
    IEnumerator spawnInSeconds(ThingToSpawn thingToSpawn)
    {
        yield return(new WaitForSeconds(thingToSpawn.timer));

        spawnThing(thingToSpawn);
    }