// 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]);
        }
    }
    int pieceType;         //What the piece type is. Each int stands for a different piece

    void Start()
    {
        //Get the current row and column and store it
        curColumn = InstantiateBlocks.getCurColumn(this.gameObject.transform.position);
        curRow    = InstantiateBlocks.getCurRow(this.gameObject.transform.position);

        //Instantiate ends and set all to true
        ends = new bool[4];
        setEnds(true, true, true, true);

        //Check whether or not the piece has been created in another game
        isUsed = PlayerPrefs.GetInt(curRow.ToString() + curColumn.ToString() + "isUsed") == 1;

        #region LoadingAlreadyCreatedBlocks
        if (isUsed)
        {
            pieceType = PlayerPrefs.GetInt(curRow.ToString() + curColumn.ToString() + "pieceType");
            if (pieceType == 1)
            {
                this.loadPiece(Resources.Load("TwoDoorRoom") as GameObject, new Vector3(0, 0, 0));
            }
            else if (pieceType == 2)
            {
                this.loadPiece(Resources.Load("TwoDoorRoom") as GameObject, new Vector3(0, 90, 0));
            }
            else if (pieceType == 3)
            {
                this.loadPiece(Resources.Load("CornerRoom") as GameObject, new Vector3(0, 0, 0));
            }
            else if (pieceType == 4)
            {
                this.loadPiece(Resources.Load("CornerRoom") as GameObject, new Vector3(0, 90, 0));
            }
            else if (pieceType == 5)
            {
                this.loadPiece(Resources.Load("CornerRoom") as GameObject, new Vector3(0, 180, 0));
            }
            else if (pieceType == 6)
            {
                this.loadPiece(Resources.Load("CornerRoom") as GameObject, new Vector3(0, 270, 0));
            }
            else if (pieceType == 7)
            {
                this.loadPiece(Resources.Load("ThreeDoorRoom") as GameObject, new Vector3(0, 0, 0));
            }
            else if (pieceType == 8)
            {
                this.loadPiece(Resources.Load("ThreeDoorRoom") as GameObject, new Vector3(0, 90, 0));
            }
            else if (pieceType == 9)
            {
                this.loadPiece(Resources.Load("ThreeDoorRoom") as GameObject, new Vector3(0, 180, 0));
            }
            else if (pieceType == 10)
            {
                this.loadPiece(Resources.Load("ThreeDoorRoom") as GameObject, new Vector3(0, 270, 0));
            }
            else if (pieceType == 11)
            {
                this.loadPiece(Resources.Load("FourDoorRoom") as GameObject, new Vector3(0, 0, 0));
            }
            #endregion
        }
    }