Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        FixedParameters fp = FixedParameters.GetInstance();

        numHoles       = fp.numHoles;
        blocksPlacedUI = GetComponent <Text>();
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        FixedParameters fp = FixedParameters.GetInstance();

        timeDeduction       = fp.timeDeduction;
        timeInvincible      = fp.timeInvincible;
        rb2d                = GetComponent <Rigidbody2D>();
        rb2d.freezeRotation = true;
        sr = GetComponent <SpriteRenderer>();
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        FixedParameters fp = FixedParameters.GetInstance();
        float           x  = fp.numCols * fp.WALL_DISTANCE / 2.0F;
        float           y  = -fp.numRows * fp.WALL_DISTANCE / 2.0F;

        mazeCentre   = new Vector3(x, y, -10);
        nextSize     = Mathf.Max(x * 0.5625F, -y * 1.125F);
        offset       = transform.position - player.transform.position;
        playerCamera = GetComponent <Camera>();
    }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        FixedParameters fp = FixedParameters.GetInstance();

        HALF_WALL_DISTANCE    = fp.HALF_WALL_DISTANCE;
        QUARTER_WALL_DISTANCE = fp.QUARTER_WALL_DISTANCE;

        numRows  = fp.numRows;
        numCols  = fp.numCols;
        numHoles = fp.numHoles;

        holes  = new int[numHoles, 2];
        blocks = new int[numHoles, 2];

        for (int i = 0; i < numHoles; i++)
        {
            holes[i, 0]  = Random.Range(0, numRows);
            holes[i, 1]  = Random.Range(0, numCols * 2);
            blocks[i, 0] = Random.Range(numRows, numRows * 2);
            blocks[i, 1] = Random.Range(0, numCols * 2);
        }
        SpawnNewBlockHolePair();
    }
Ejemplo n.º 5
0
    void Start()
    {
        FixedParameters fp = FixedParameters.GetInstance();

        timeout = fp.timeout;
    }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        FixedParameters fp = FixedParameters.GetInstance();

        requireInitialInstructions = fp.requireInitialInstructions;
    }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        FixedParameters fp = FixedParameters.GetInstance();

        WALL_DISTANCE         = fp.WALL_DISTANCE;
        HALF_WALL_DISTANCE    = fp.HALF_WALL_DISTANCE;
        QUARTER_WALL_DISTANCE = fp.QUARTER_WALL_DISTANCE;

        numRows   = fp.numRows;
        numCols   = fp.numCols;
        trapCount = fp.trapCount;
        numGuards = fp.numGuards;


        horizontalWalls = new int[numRows + 1, numCols];

        verticalWalls = new int[numRows, numCols + 1];

        visited = new int[numRows, numCols];

        traps = new int[trapCount, 2];

        guards = new int[numGuards, 2];

        borderList = new List <Border>();



        for (int i = 0; i < horizontalWalls.GetLength(0); i++)
        {
            for (int j = 0; j < horizontalWalls.GetLength(1); j++)
            {
                horizontalWalls[i, j] = 1;
            }
        }

        for (int i = 0; i < verticalWalls.GetLength(0); i++)
        {
            for (int j = 0; j < verticalWalls.GetLength(1); j++)
            {
                verticalWalls[i, j] = 1;
            }
        }

        for (int i = 0; i < visited.GetLength(0); i++)
        {
            for (int j = 0; j < visited.GetLength(1); j++)
            {
                visited[i, j] = 0;
            }
        }

        //horizontalWalls[numRows, numCols - 1] = 0;
        //verticalWalls[0, 0] = 0;

        for (int i = 0; i < traps.GetLength(0); i++)
        {
            traps[i, 0] = Random.Range(0, numRows * 2);
            traps[i, 1] = Random.Range(0, numCols * 2);
            while (traps[i, 0] == 0 && traps[i, 1] == 0)
            {
                traps[i, 0] = Random.Range(0, numRows * 2);
                traps[i, 1] = Random.Range(0, numCols * 2);
            }
        }

        for (int i = 0; i < guards.GetLength(0); i++)
        {
            guards[i, 0] = Random.Range(0, numRows * 2);
            guards[i, 1] = Random.Range(0, numCols * 2);
        }



        ProcessCell(numRows - 1, numCols - 1);
        while (borderList.Count > 0)
        {
            int    index           = Random.Range(0, borderList.Count);
            Border borderToProcess = borderList[index];
            Border nextBorder      = borderList[borderList.Count - 1];
            borderList[index] = nextBorder;
            borderList.RemoveAt(borderList.Count - 1);
            ProcessWall(borderToProcess.orientation, borderToProcess.arrRow, borderToProcess.arrCol);
        }

        // walls
        for (int i = 0; i < horizontalWalls.GetLength(0); i++)
        {
            for (int j = 0; j < horizontalWalls.GetLength(1); j++)
            {
                if (horizontalWalls[i, j] == 1)
                {
                    Instantiate(wall, new Vector2((j * WALL_DISTANCE) + HALF_WALL_DISTANCE, -(i * WALL_DISTANCE)), Quaternion.identity);
                }
            }
        }
        for (int i = 0; i < verticalWalls.GetLength(0); i++)
        {
            for (int j = 0; j < verticalWalls.GetLength(1); j++)
            {
                if (verticalWalls[i, j] == 1)
                {
                    Instantiate(wall, new Vector2(j * WALL_DISTANCE, -((i * WALL_DISTANCE) + HALF_WALL_DISTANCE)), Quaternion.Euler(0, 0, 90));
                }
            }
        }

        // traps
        for (int i = 0; i < traps.GetLength(0); i++)
        {
            int        trapRow = traps[i, 0];
            int        trapCol = traps[i, 1];
            GameObject newWall = (GameObject)Instantiate(trap, new Vector2(trapCol * HALF_WALL_DISTANCE + QUARTER_WALL_DISTANCE,
                                                                           -(trapRow * HALF_WALL_DISTANCE) - QUARTER_WALL_DISTANCE), Quaternion.identity);
            newWall.GetComponent <TrapGPS>().trapStateOn = ((trapRow + trapCol) % 3) + 1;
        }

        // guards
        for (int i = 0; i < guards.GetLength(0); i++)
        {
            int guardRow = traps[i, 0];
            int guardCol = traps[i, 1];
            Instantiate(guard, new Vector2(guardCol * HALF_WALL_DISTANCE + QUARTER_WALL_DISTANCE,
                                           -(guardRow * HALF_WALL_DISTANCE) - QUARTER_WALL_DISTANCE), Quaternion.identity);
        }
    }