Example #1
0
    void Spawn(float x, float y, string conexions, RoomCreator.RoomType type)
    {
        Vector2 spawnPos = new Vector2(x, y);

        RoomCreator.Conexions nameEnum = (RoomCreator.Conexions)Enum.Parse(typeof(RoomCreator.Conexions), conexions);
        Room room = roomScript.SetupRoom(nameEnum, spawnPos, type, boss);

        room.SetEnemies(enemiesPrefabs, turretsPrefabs);
        rooms.Add(spawnPos, room);
    }
Example #2
0
    public Room(RoomType rt, Status s, Vector2 p, Conexions c, GameObject b)
    {
        roomType   = rt;
        status     = s;
        position   = p;
        conexions  = c;
        bossPrefab = b;
        if (roomType == RoomType.boss)
        {
            Vector3    pos        = p;
            Quaternion quaternion = Quaternion.identity;
            int        direction  = 0;
            switch (c)
            {
            case Conexions.T:
                pos        = new Vector3(p.x + 7.5f, p.y + 4, 0);
                quaternion = Quaternion.identity;
                direction  = 0;
                break;

            case Conexions.B:
                pos        = new Vector3(p.x + 7.5f, p.y + 12, 0);
                quaternion = Quaternion.Euler(new Vector3(0, 0, 180));
                direction  = 1;
                break;

            case Conexions.L:
                pos        = new Vector3(p.x + 12, p.y + 7.5f, 0);
                quaternion = Quaternion.Euler(new Vector3(0, 0, 90));
                direction  = 2;
                break;

            case Conexions.R:
                pos        = new Vector3(p.x + 4, p.y + 7.5f, 0);
                quaternion = Quaternion.Euler(new Vector3(0, 0, 270));
                direction  = 3;
                break;

            default:
                break;
            }

            bossEnemy = Instantiate(bossPrefab, pos, quaternion);
            bossEnemy.GetComponent <BossEnemy>().SetDirection(direction);
            bossEnemy.GetComponent <BossEnemy>().SetRoom(this);
            nEnemies = 1;
        }
    }