Ejemplo n.º 1
0
    public void resetChildren()
    {
        squareStatus mainStatus     = GetComponentInParent <squareStatus>();
        squareStatus topStatus      = childTop.GetComponent <squareStatus>();
        squareStatus rightStatus    = childRight.GetComponent <squareStatus>();
        squareStatus topRightStatus = childTopRight.GetComponent <squareStatus>();

        mainStatus.resetSquare();
        topStatus.resetSquare();
        rightStatus.resetSquare();
        topRightStatus.resetSquare();
        squareRight.transform.parent    = this.transform.parent;
        squareTop.transform.parent      = this.transform.parent;
        squareTopRight.transform.parent = this.transform.parent;
    }
Ejemplo n.º 2
0
 void OnMouseOver()
 {
     getFourByFourSquares();
     highlightSquares();
     //Debug.Log(mainStatus.name);
     if (Input.GetMouseButtonDown(0) || checkTouch.touchDown)
     {
         if (!mainStatus.isOccupied && !rightStatus.isOccupied && !topStatus.isOccupied && !topRightStatus.isOccupied && buildingSelect.currentBuilding != null)//places building and stores data in bottom left square
         {
             setHighlightedToOccupied(buildingSelect.currentBuilding);
             setChildren();
             squareRight.transform.parent    = this.transform;
             squareTop.transform.parent      = this.transform;
             squareTopRight.transform.parent = this.transform;
         }
         if (mainStatus.isOccupied && rightStatus.isOccupied && topStatus.isOccupied && topRightStatus.isOccupied && buildingSelect.currentBuilding == null)//removes building and resets all squares to default status
         {
             mainStatus.resetSquare();
             topStatus.resetSquare();
             rightStatus.resetSquare();
             topRightStatus.resetSquare();
             squareRight.transform.parent    = this.transform.parent;
             squareTop.transform.parent      = this.transform.parent;
             squareTopRight.transform.parent = this.transform.parent;
         }
         try
         {
             if (currentParent.GetComponent <squareStatus>().holdsBuilding&& buildingSelect.currentBuilding == null) //this is to delete building and reset all squares, currently throwing NULL due to
             {                                                                                                       //overlap with previous button check, once buttons are added this will be nullified.
                 currentParent.GetComponent <placementManager>().resetChildren();
             }
         } catch (Exception e)
         {
         }
     }
 }