// Use this for initialization

    // Update is called once per frame
    void Update()
    {
        int direction = 0;

        //Get the direction based on what button they're pressing
        direction += Input.GetKeyDown(KeyCode.LeftArrow) ? -1 : 0;
        direction += Input.GetKeyDown(KeyCode.RightArrow) ? 1 : 0;

        timeCounter -= Time.deltaTime;
        if (!is_instantiated && timeCounter <= 0 && isLocalPlayer)
        {
            int rand = Random.Range(0, 6);
            selectedObject = block_list[rand];

            //Choose block to spawn and re-enable highlight
            toDrop = Instantiate(selectedObject, this.gameObject.transform.position, Quaternion.identity, this.gameObject.transform);
            //disables box colliders in indicator
            foreach (BoxCollider child in toDrop.GetComponentsInChildren <BoxCollider>())
            {
                child.enabled = false;
            }
            //Cmdtry_block_spawn();
            areaHighlight.AdjustHighlightScaleAndOffsetFor(toDrop);
            SetHighlightActive(true);

            resetCurrentRotation();
            is_instantiated = true;
        }
        if (toDrop)
        {
            RotateObject(direction);
            toDrop.transform.position = this.gameObject.transform.position;
            areaHighlight.MoveHighlightTo(toDrop);

            if (Input.GetKeyDown(KeyCode.Space) || timeCounter <= -3f)  //change value here to determine the amount of time it takes to auto drop block subtracting from 1.5f so at -3f it auto spawns in 4.5 seconds etc.
            {
                if (isLocalPlayer)
                {
                    // Let the block drop and disable the highlight
                    Destroy(toDrop);
                    Cmdtry_block_spawn();

                    is_instantiated = false;

                    SetHighlightActive(false);
                    timeCounter = timeTilNextBlock;
                    toDrop      = null;
                    //next_selected_object();
                }
            }
        }
    }
    //sets the indicator's rotation
    void RotateIndicator(float angle)
    {
        if (indicator == null)
        {
            return;
        }
        indicator.transform.rotation = Quaternion.AngleAxis(angle, transform.forward);

        //Adjust highlight scale after indicator changes rotation
        areaHighlight.AdjustHighlightScaleAndOffsetFor(indicator);
    }
 //================================================================================
 // Highlight functions
 //================================================================================
 void CreateHighlight()
 {
     areaHighlight = Instantiate(areaHighlightPrefab.gameObject).GetComponent <HighlightBehaviour>();
     areaHighlight.AdjustHighlightScaleAndOffsetFor(indicator);
 }