Ejemplo n.º 1
0
    private void Awake()
    {
        //var watch = System.Diagnostics.Stopwatch.StartNew();

        properties = GameObject.FindObjectOfType <Properties>();

        VectArrayBoolInt aux;

        floor = new Floor();

        floor.AddRoom(new Square(new Vector3(0, 0, 0),
                                 new bool[] { false, false, true, false }, 0));

        for (int i = 1; i < properties.NumRoom - 1; i++)
        {
            aux = CardinalSelector(RoomSelector(i - 1));

            switch (aux.innt)
            {
            case 0:
                floor.AddRoom(new Square(aux.vector3, aux.arrayBool, i));
                break;

            case 1:
                floor.AddRoom(new RectangleV(aux.vector3, aux.arrayBool, i));
                break;

            case 2:
                floor.AddRoom(new RectangleH(aux.vector3, aux.arrayBool, i));
                break;

            case 3:
                floor.AddRoom(new Square2(aux.vector3, aux.arrayBool, i));
                break;

            case 4:
                floor.AddRoom(new HexagonalV(aux.vector3, aux.arrayBool, i));
                break;

            case 5:
                floor.AddRoom(new HexagonalH(aux.vector3, aux.arrayBool, i));
                break;

            case 10:
                floor.AddRoom(new Triangle(aux.vector3, aux.arrayBool,
                                           i, Quaternion.identity));
                break;

            case 11:
                floor.AddRoom(new Triangle(aux.vector3, aux.arrayBool,
                                           i, Quaternion.Euler(new Vector3(0, 90, 0))));
                break;

            case 12:
                floor.AddRoom(new Triangle(aux.vector3, aux.arrayBool,
                                           i, Quaternion.Euler(new Vector3(0, 180, 0))));
                break;

            case 13:
                floor.AddRoom(new Triangle(aux.vector3, aux.arrayBool,
                                           i, Quaternion.Euler(new Vector3(0, 270, 0))));
                break;
            }
        }
        aux = BossRoomSelector();
        floor.AddRoom(new Octagon(aux.vector3, aux.arrayBool, properties.NumRoom));
        floor.AddCorridors();
        floor.AddWalls();

        //watch.Stop();
        //var elapsedMs = watch.ElapsedMilliseconds;
        //Debug.Log(elapsedMs);
    }