Assets/Scripts/BoardManager.cs
/// <summary>
/// updates the CurrentX and CurrentZ to the elected tile x and z 
/// </summary>
updates the CurrentX and CurrentZ to the elected tile x and z
updates the CurrentX and CurrentZ to the elected tile x and z
void UpdateSelection()
    {
        if (!Camera.main) {
            return;
        }
        RaycastHit hit;
        if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 25.0f, LayerMask.GetMask("ChessPlane")))
        {
            CurrentTileX = (int)(hit.point.x + offsetX);
            CurrentTileZ = (int)(hit.point.z + offsetZ);
        }
        else
        {
            CurrentTileX = -1;
            CurrentTileZ = -1;
        }
    }
void UpdateSelection ( ) { if ( ! Camera . main ) { return ; } RaycastHit hit ; if ( Physics . Raycast ( Camera . main . ScreenPointToRay ( Input . mousePosition ) , out hit , 25.0f , LayerMask . GetMask ( " " ) ) ) { CurrentTileX = ( int ) ( hit . point . x + offsetX ) ; CurrentTileZ = ( int ) ( hit . point . z + offsetZ ) ; } else { CurrentTileX = - 1 ; CurrentTileZ = - 1 ; } }
updates the CurrentX and CurrentZ to the elected tile x and z
updates the CurrentX and CurrentZ to the elected tile x and z
//LayerMask.GetMask("ChessPlane") returns the int in layers in the chess board //where did the collision happened