private void Start()
 {
     Destroy(gameObject, waitTime);
     templates        = GameObject.FindGameObjectWithTag("RoomTemplate").GetComponent <RoomTemplates>();
     transform.parent = templates.roomListContainer.transform;
     Invoke("Spawn", 0.2f);
 }
Beispiel #2
0
 private void Start()
 {
     Destroy(gameObject, waitTime);
     parent    = GameObject.Find("Total Rooms").GetComponent <Transform>();
     templates = GameObject.FindGameObjectWithTag("RoomsTemplates").GetComponent <RoomTemplates>();
     Invoke("Spawn", 0.1f);
 }
Beispiel #3
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if ((other.CompareTag("SpawnPoint") && other.GetComponent <RoomSpawner>().spawned == true) || other.CompareTag("EntrySpawn"))
     {
         if (templates == null)
         {
             templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
         }
         if (templates.roomSpawns.Contains(this))
         {
             templates.roomSpawns.Remove(this);
         }
         if (templates.finalSpawns.Contains(this))
         {
             templates.finalSpawns.Remove(this);
         }
         if (other.CompareTag("SpawnPoint"))
         {
             RoomSpawner otherspawner = other.GetComponent <RoomSpawner>();
             for (int i = 0; i < doors.Length; i++)
             {
                 if (doors[i] && !otherspawner.doors[i])
                 {
                     otherspawner.doors[i] = true;
                     Instantiate(getEndRoom(i), otherspawner.transform.position, Quaternion.identity);
                 }
             }
         }
         //Debug.Log("Enter " + transform.position.x + ", " + transform.position.y + ": " + doors[0] + "," + doors[1] + "," + doors[2] + "," + doors[3]);
         Destroy(gameObject);
     }
 }
Beispiel #4
0
 // Start is called before the first frame update
 void Start()
 {
     deadends = 0;
     Destroy(gameObject, waitTime);
     templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     Invoke("Spawn", 0.35f);
 }
Beispiel #5
0
    // Start is called before the first frame update
    void Start()
    {
        //Retrieve player controller to move player with
        playerController = PlayerController2D.instance;

        //Possible room templates
        templates = GetComponent <RoomTemplates>();
        switch (currentBiome)
        {
        case Biome.GRASS:
            biomeRooms = templates.grassRooms;
            break;

        case Biome.DUNGEON:
            biomeRooms = templates.dungeonRooms;
            break;

        default:
            break;
        }

        //Add first/start room
        AddRoom(templates.roomsPerBiome[currentBiome].rooms[0]);

        AddExits(gameObject.transform.GetChild(0));

        //Register event for roomclear
        EnemySpawner.instance.OnAllEnemiesCleared += SpawnLoot;
    }
Beispiel #6
0
    void Start()
    {
        templates = GameObject.FindGameObjectWithTag("RoomTemplate").GetComponent <RoomTemplates>();

        // 방을 생성하기전 Block 여부 판단, Destoryer와 충돌여부 판단을 위해 일정시간 후 생성
        Invoke("Spawn", 0.15f);
    }
Beispiel #7
0
 void OnTriggerEnter2D(Collider2D other)
 {
     try
     {
         templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
         if (templates.doors.Contains(transform.parent.gameObject) == false)
         {
             if (other.gameObject.tag == "Door" || transform.parent.parent.parent.parent.GetComponent <AddRoom>().roomNumber <= 5)
             {
                 // templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent<RoomTemplates>();
                 templates.doors.Add(transform.parent.gameObject);
                 transform.parent.gameObject.SetActive(false);
                 trans = transform.position;
                 // Debug.Log("Test");
             }
             else
             {
                 templates.test++;
                 // Debug.Log(other.gameObject.tag);
                 // Debug.Log(transform.parent.parent.parent.parent.gameObject.name);
             }
         }
     }
     catch (Exception e)
     {
         // print(obj);
         // print("Door error");
     }
 }
 void Start()
 {
     searchForNeighbors = GetComponent <SearchForNeighborRooms>();
     templates          = FindObjectOfType <RoomTemplates>();
     Invoke("ReplaceSpawnedRoom", 4f);
     Destroy(this, waitTime);
 }
Beispiel #9
0
 private void Start()
 {
     Destroy(gameObject, waittime);
     // Sets template to the list of rooms declared in "RoomTemplates"
     templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     Invoke("Spawn", 0.1f);
 }
Beispiel #10
0
    public void SetupScene(int level)
    {
        difficultyLevel = level;

        roomTemplates = gameObject.GetComponent <RoomTemplates>();

        Transform firstRoomTransform = new GameObject("Room " + levelMap.Count).transform;
        Room      firstRoom          = firstRoomTransform.gameObject.AddComponent <Room>();

        firstRoom.position = new Vector3(0f, 0f, 0f);
        firstRoom.doors    = new int[4] {
            1, 1, 1, 1
        };
        firstRoom.size = roomTemplates.templates[0].size;
        occupiedPositions.Add(firstRoom.position);
        CreateRoom(firstRoom);
        levelMap.Add(firstRoom);

        for (int i = 0; i < firstRoom.doors.Length; i++)
        {
            if (i % 2 == 0)
            {
                NewCorridor(Vector3.zero, roomTemplates.roomOffsets[i], 2, i);
            }
            else
            {
                NewCorridor(Vector3.zero, roomTemplates.roomOffsets[i], 1, i);
            }
        }
    }
Beispiel #11
0
 void Start()
 {
     player        = GameObject.FindGameObjectWithTag("Player").transform;
     roomTemplates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     timeline      = GameObject.FindGameObjectWithTag("Timeline").GetComponent <PlayableDirector>();
     audio         = GetComponentInChildren <AudioSource>();
 }
 void Start()
 {
     roomScript = gameObject.transform.parent.gameObject.GetComponent <RoomScript>();
     templates  = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     Invoke("Spawn", templates.waitTime % 0.25f);
     //Destroy(gameObject, templates.waitTime * 2.0f);
 }
Beispiel #13
0
    private void Update()
    {
        noOfRooms = roomControl.noOfRooms;
        table     = GameObject.FindGameObjectWithTag("TableRooms");
        started   = roomControl.started;

        if (!blocked)
        {
            if (noOfRooms < 4)
            {
                templates = GameObject.Find("Room Templates Initial").GetComponent <RoomTemplates>();
            }
            if ((noOfRooms >= 4) && (noOfRooms < 10))
            {
                templates = GameObject.Find("Room Templates All").GetComponent <RoomTemplates>();
            }
            else if ((noOfRooms >= 10) && (noOfRooms < 16))
            {
                templates = GameObject.Find("Room Templates Small").GetComponent <RoomTemplates>();
            }
            else if (noOfRooms >= 16)
            {
                templates = GameObject.Find("Room Templates Small 1 Exit").GetComponent <RoomTemplates>();
            }
        }
        ButtonClickRoomSpawn();
    }
    void Start()
    {
        roomTemplates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();

        //Change to a Switch Statement
        if (doorDir == 1)
        {
            randNum = Random.Range(0, roomTemplates.bottomDoors.Count);
            Instantiate(roomTemplates.bottomDoors[randNum], transform.position, roomTemplates.bottomDoors[randNum].transform.rotation);
            //Spawn a Room with a Bottom Door.
        }
        if (doorDir == 2)
        {
            randNum = Random.Range(0, roomTemplates.leftDoors.Count);
            Instantiate(roomTemplates.leftDoors[randNum], transform.position, roomTemplates.leftDoors[randNum].transform.rotation);
            //Spawns a Room with a Left Door.
        }
        if (doorDir == 3)
        {
            randNum = Random.Range(0, roomTemplates.rightDoors.Count);
            Instantiate(roomTemplates.rightDoors[randNum], transform.position, roomTemplates.rightDoors[randNum].transform.rotation);
            //Spawn a Room with a Right Door.
        }
        if (doorDir == 4)
        {
            randNum = Random.Range(0, roomTemplates.topDoors.Count);
            Instantiate(roomTemplates.topDoors[randNum], transform.position, roomTemplates.topDoors[randNum].transform.rotation);
            //Spawn a Room with a Top Door.
        }
    }
Beispiel #15
0
 void Start()
 {
     GM        = GameObject.FindObjectOfType <GameManager>();
     templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     Invoke("Spawn", 0.5f);
     Destroy(gameObject, waitTime);
 }
 private void Start()
 {
     Destroy(gameObject, 4f);
     templates = GameObject.FindGameObjectWithTag("RoomTemplates").GetComponent <RoomTemplates>();
     spawned   = false;
     Invoke("Spawn", 0.2f);
 }
Beispiel #17
0
 void Start()
 {
     Grid = GameObject.Find("Grid");
     Destroy(gameObject, waitTime);
     templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     Invoke("Spawn", (0.1f + Random.Range(0f, 1.9f)));
 }
Beispiel #18
0
 void Start()
 {
     Destroy(gameObject, waitTime);
     templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     Invoke("Spawn", 1.1f);
     // StartCoroutine("SpawnAndWait()");
     //Spawn();
 }
 void Start()
 {
     
     templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent<RoomTemplates>();
     
     Invoke("spawn", 0.1f);
     Debug.Log("works");
 }
    private void Changeinterest()
    {
        RoomTemplates m_RT = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
        int           r    = Random.Range(0, m_RT.m_RoomsList.Count - 1);

        m_TargetPos = m_RT.m_RoomsList[r].transform.position;
        m_Interest  = 10f;
    }
    void Start()
    {
        roomStat = Resources.FindObjectsOfTypeAll <RoomStats>()[0];
        roomStat.finishGeneration = false;

        templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
        Invoke("Spawn", 0.2f);
    }
Beispiel #22
0
    // Start is called before the first frame update
    void Start()
    {
        // Tag attached to only one object, this object manages all rooms
        roomTemplates = GameObject.FindGameObjectWithTag("RoomTemplates").GetComponent <RoomTemplates>();

        // Invoke method with delay to avoid spawn collisions
        Invoke("SpawnRooms", Random.Range(0.1f, 0.2f));
    }
Beispiel #23
0
    // Use this for initialization
    void Awake()
    {
        Destroy(gameObject, waitTime);
        templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
        room      = GetComponentInParent <AddRoom>();

        Invoke("Spawn", Random.Range(0.1f, 0.3f)); //Este random lo he puesto para que no se superpongan las habitaciones en casos especiales
    }
 private void Start()
 {
     collector     = GameObject.FindGameObjectWithTag("winText");
     collectorText = collector.GetComponent <TextMeshProUGUI>();
     templates     = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     timer         = GameObject.FindGameObjectWithTag("timer");
     timerText     = timer.GetComponent <TextMeshProUGUI>();
 }
Beispiel #25
0
 void Start()
 {
     lights        = transform.GetChild(0).gameObject.GetComponent <Light>();
     tracker       = transform.GetChild(2).gameObject;
     roomTemplates = GameObject.Find("Station").GetComponent <RoomTemplates>();
     endingScript  = GameObject.Find("Ending Interior").GetComponent <EndingScript>();
     StartCoroutine(lightTimer(0.5F));
 }
Beispiel #26
0
    void Start()
    {
        myCollider = GetComponent <BoxCollider2D>();
        templates  = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();

        Invoke("Spawn", 0.3f);
        Destroy(gameObject, waitTime);
    }
Beispiel #27
0
 public override void Start()
 {
     loseText.SetActive(false);
     winText.SetActive(false);
     loadingCanvas.gameObject.SetActive(true);
     rt = GameObject.Find("Entry Room").GetComponent <RoomTemplates>();
     Invoke("populateRooms", rt.waitTime);
 }
Beispiel #28
0
 private void Start()
 {
     Destroy(gameObject, waitTime);
     templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
     Debug.Log("set templates");
     Invoke("Spawn", 1f);
     Debug.Log("invoked Spawn");
 }
Beispiel #29
0
    // public int[] spawnDirs;

    private void Start()
    {
        templates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();
        templates.rooms.Add(this.gameObject);

        // spawnDirs = new int[4];
        // spawnDirs = currRoom.transform.Find("SpawnPoint").GetComponent<RoomSpawner>().openingDirection;
    }
Beispiel #30
0
    void Start()
    {
        Destroy(gameObject, _destroyAfter); // clears up memory by removing the spawn points
        _roomTemplates = GameObject.FindGameObjectWithTag("Rooms").GetComponent <RoomTemplates>();

        Invoke("SpawnRooms", 0.1f);
        Invoke("CheckMissingRoom", 1f);
    }