protected void onStay(Collider2D c)
 {
     if (tetrisParentTest(s_TetrisBlock.BlockPurpose.VIRTUAL, true))
     {
         s_Block block = c.gameObject.GetComponent <s_Block>(); //gets a referance to the tile the block just entered
         if (block != null)
         {
             if (transform.position == block.transform.position)          // if the transform of this is equal to the transform of another block which should only happen if they are occupying the same tile
             {
                 if (currentTile != null && currentTile.occupant != this) //if this does have a current tile and that tile's occupant is not this block
                 {
                     if (currentTile.GetUpTile() != null)                 // if there is a tile above the tile with overlapping s_Blocks
                     {
                         //transform.position = currentTile.GetUpTile().transform.position;//move the s_block up a tile
                         //currentState = states.MOVING;
                         //currentTile = null;
                     }
                     else
                     {
                         LoseGame();// Call the EndGame function from the game manager script
                     }
                 }
             }
         }
     }
 }
 public void BeginStopInEnteredTile()
 {
     if (enteredTile != null && enteredTile.CanSupportBlock()) //checks to see if the tile below this one is empty or if there is no tile below this one
     {
         if (currentTile == null)
         {
             currentTile = enteredTile; //Sets the tile that block will have as its location to the current tile it is in
             s_Block otherSBlock = currentTile.GetTileOccupant();
             if (otherSBlock == null || otherSBlock == this)
             {
                 setState(states.STOPPING); //if it is empty then transitions to stopping
             }
             else
             {
                 if (//((int)currentState < (int)otherSBlock.GetCurrentState()) ||
                     (otherSBlock.transform.position.y < transform.position.y))
                 {
                     MoveUpATile();
                 }
                 else
                 {
                     otherSBlock.MoveUpATile();
                 }
             }
         }
     }
 }
 public void AddSBlock(s_Block blockToAdd)
 {
     if (!mySBlocks.Contains(blockToAdd))
     {
         trashCount++;
         mySBlocks.Add(blockToAdd);
     }
 }
 public void RemoveSBlock(s_Block blockToRemove)
 {
     if (mySBlocks.Contains(blockToRemove))
     {
         if (trashCount > 1)
         {
             trashCount--;
         }
         mySBlocks.Remove(blockToRemove);
     }
 }
 //clears the block from the tile
 void clearOccupant()
 {
     if (occupant != null)
     {
         occupant.Die();
         occupant = null;
     }
     else
     {
         if (s_GameManager.GetDebug())
         {
             Debug.Log("Occupant of tile is already set to null and cannot be cleared.  This may be an error.  If game contiues to work please ignore.");
         }
     }
 }
 //sets the occupant to fall and tile to empty
 public void SetContentsToFall()
 {
     if (occupant != null)
     {
         int jumpAmount = 0;
         foreach (s_Tile T in owningPlayer.GetTileList())
         {
             if (T != this && T.GetColumnIn() == GetColumnIn() && T.transform.position.y < transform.position.y)
             {
                 jumpAmount++;
             }
         }
         occupant.transform.position += new Vector3(0, 0.05f * jumpAmount, 0);
         //* (tilePosition / owningPlayer.GetColumnCount()
         occupant.StartFalling();
         occupant = null;
     }
     content = Contents.NONE;
 }
    //This code runs when a block enters a new tile
    protected void onEnter(Collider2D c)
    {
        s_Tile  myTile = c.gameObject.GetComponent <s_Tile>();  //gets a referance to the tile the block just entered
        s_Block block  = c.gameObject.GetComponent <s_Block>(); //gets a referance to the tile the block just entered

        if (canOccupyTile && tetrisParentTest(s_TetrisBlock.BlockPurpose.VIRTUAL, true))
        {
            if (myTile != null)//if it has collided with a tile
            {
                SetLastTileEntered(myTile);
                if (myTile.GetTilePosition() < owningPlayer.GetColumnCount() &&
                    (myTile.occupant == null || myTile.occupant == this))
                {
                    currentTile        = enteredTile;
                    transform.position = currentTile.transform.position;
                    setState(states.STOPPING);
                }
                else
                {
                    BeginStopInEnteredTile();
                }
            }
        }
    }
 //gives the tile a referance to the block occupying it
 public void SetTileOccupant(s_Block myBlock)
 {
     occupant = myBlock;
 }