RoadCreator.Update C# (CSharp) Method

Update() private method

private Update ( ) : void
return void
    void Update()
    {
        if (Input.GetKeyDown (KeyCode.F2) && !_onCreation) {
            _onCreation = true;
            Ray r = Camera.main.ScreenPointToRay (Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast (r, out hit)) {
                Vector3 StPt = hit.point;
                float CellSize = ModuleCreator.Instance.GridCellSize;
                StPt.x = ((StPt.x % CellSize < CellSize / 2f) ? CellSize * ((int)(StPt.x / CellSize)) : CellSize * ((int)(StPt.x / CellSize) + 1)) + 0.5f;
                StPt.z = ((StPt.z % CellSize < CellSize / 2f) ? CellSize * ((int)(StPt.z / CellSize)) : CellSize * ((int)(StPt.z / CellSize) + 1)) + 0.5f;
                StPt.y = 0f;
                StartCoroutine (CreateRoad (StPt));
            }
        }
    }