Exemple #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.name == "AntiSpawnSpaceSpawner")
        {
            collisionNumber++;
            //if a spawn point collides with a room, it adds a tick to the collider number
            // this means that if it collides twice (from the two rooms overlapping, it'll have a collider number of 2)
            // if it collides none, then that means its a room on the end (reached 40 room limit) - a door block is spawned accordingly
        }

        if (collision.gameObject.GetComponent <AntiSpawnSpaceDetailer>() == null)
        {
            return;
        }

        switch (openDirection)
        {
        //Checks if the doorway is open or not
        case 1:
            if (collision.GetComponent <AntiSpawnSpaceDetailer>().topOpening != true)
            {
                spawnDoorBlock();
            }
            break;

        case 2:
            if (collision.GetComponent <AntiSpawnSpaceDetailer>().bottomOpening != true)
            {
                spawnDoorBlock();
            }
            break;

        case 3:
            if (collision.GetComponent <AntiSpawnSpaceDetailer>().rightOpening != true)
            {
                spawnDoorBlock();
            }
            break;

        case 4:
            if (collision.GetComponent <AntiSpawnSpaceDetailer>().leftOpening != true)
            {
                spawnDoorBlock();
            }
            break;
        }
        dontSpawn = true;

        if (templates.areRoomsSpawned())
        {
            if (collision.gameObject.name != "AntiSpawnSpaceSpawner")
            {
                spawnDoorBlock();
            }
        }
    }
Exemple #2
0
    IEnumerator waitForSpawned()
    {
        while (roomTemplates.areRoomsSpawned() != true)
        {
            yield return(null);
        }

        foreach (AntiSpawnSpaceDetailer room in roomTemplates.antiList)
        {
            room.GetComponent <FogCycleRoom>()?.SetFogController(this);
        }
    }
Exemple #3
0
 void Update()
 {
     if (
         templates.areRoomsSpawned() &&
         loadIn == false
         )
     {
         PlayerProperties.playerScript.playerDead = false;
         loadIn = true;
         animator.SetTrigger("FadeOut");
         Destroy(this.gameObject, 1f);
     }
 }