// Use this for initialization
    void Start()
    {
        //ends = 2;
        //rotations = 0;
        pieceName = "Two Door Hallway";
        //Set endsUsed relative to what ends are being used
        //NOTE- Exact values are not being used because sometimes they do not register exact values (DONT KNOW WHY-TRIED TO FIX FOR HOURS)
        endsUsed = new bool[4];
        if (this.gameObject.transform.eulerAngles.y >= 85 && this.gameObject.transform.eulerAngles.y <= 95)
        {
            endsUsed [0] = true;
            endsUsed [1] = false;
            endsUsed [2] = true;
            endsUsed [3] = false;
        }
        else
        {
            endsUsed [0] = false;
            endsUsed [1] = true;
            endsUsed [2] = false;
            endsUsed [3] = true;
        }
        int curRow, curColumn;

        curRow    = InstantiateBlocks.getCurRow(this.gameObject.transform.position);
        curColumn = InstantiateBlocks.getCurColumn(this.gameObject.transform.position);
        if (curRow != -1 && curRow != InstantiateBlocks.getRows() && curColumn != -1 && curColumn != InstantiateBlocks.getColumns())
        {
            InstantiateBlocks.getAllBlocks() [curRow, curColumn].GetComponent <Block> ().setEnds(endsUsed [0], endsUsed [1], endsUsed [2], endsUsed [3]);
            InstantiateBlocks.getAllBlocks() [curRow, curColumn].GetComponent <Block> ().setUsed(true);
        }
    }
 // Use this for initialization
 void Start()
 {
     blocks    = InstantiateBlocks.getAllBlocks();
     rows      = InstantiateBlocks.getRows();
     columns   = InstantiateBlocks.getColumns();
     curRow    = InstantiateBlocks.getCurRow(GetComponentInParent <Block> ().gameObject.transform.position);
     curColumn = InstantiateBlocks.getCurColumn(GetComponentInParent <Block> ().gameObject.transform.position);
 }
    // Use this for initialization
    void Start()
    {
        //ends = 4;
        //rotations = 0;
        pieceName = "Four Door Hallway";
        //Set endsUsed relative to what ends are being used
        //NOTE- Exact values are not being used because sometimes they do not register exact values (DONT KNOW WHY-TRIED TO FIX FOR HOURS)
        endsUsed     = new bool[4];
        endsUsed [0] = true;
        endsUsed [1] = true;
        endsUsed [2] = true;
        endsUsed [3] = true;
        int curRow, curColumn;

        curRow    = InstantiateBlocks.getCurRow(this.gameObject.transform.position);
        curColumn = InstantiateBlocks.getCurColumn(this.gameObject.transform.position);
        InstantiateBlocks.getAllBlocks() [curRow, curColumn].GetComponent <Block> ().setEnds(endsUsed[0], endsUsed[1], endsUsed[2], endsUsed[3]);
        InstantiateBlocks.getAllBlocks() [curRow, curColumn].GetComponent <Block> ().setUsed(true);
    }
Example #4
0
    void checkAvailability()
    {
        int refRow, refColumn;                                   //reference row and column of reference block

        refRow               = InstantiateBlocks.getCurRow();    //refRow to currentRow
        refColumn            = InstantiateBlocks.getCurColumn(); //refColumn to currentColumn
        GameObject[,] blocks = InstantiateBlocks.getAllBlocks();
        //If we are at northend, refrow is one up
        if (selectedTarget.name.Equals("NorthEnd"))
        {
            refRow--;
            roomNum = 0;
        }
        else if (selectedTarget.name.Equals("EastEnd"))
        {
            //If we are at northend, refrow is one up
            refColumn++;
            roomNum = 3;
        }
        else if (selectedTarget.name.Equals("SouthEnd"))
        {
            //If we are at southend, refrow is one down
            refRow++;
            roomNum = 2;
        }
        else if (selectedTarget.name.Equals("WestEnd"))
        {
            //If we are at westend, refcol is one left
            refColumn--;
            roomNum = 1;
        }
        refBlock      = blocks [refRow, refColumn];
        possibilities = InstantiateBlocks.checkAvailability(refRow, refColumn);          //Set possibilities to available possibilities

        for (int i = 0; i < possibilities.Length; i++)
        {
            Debug.Log(possibilities [i]);
        }
    }