コード例 #1
0
ファイル: PlayerMouse.cs プロジェクト: reginleiff/this.place
    private void HandleInteractForward()
    {
        Vector3 GridSpaceCoordinate = new Vector3(
            Mathf.Round(transform.position.x),
            Mathf.Round(transform.position.y),
            Mathf.Round(transform.position.z));
        Ray        ray = new Ray(GridSpaceCoordinate, transform.forward);
        RaycastHit hit;
        bool       didRayCastHit = Physics.Raycast(ray, out hit, 0.6f, CollidableLayer);

        if (didRayCastHit)
        {
            BlockBehaviour block = hit.transform.gameObject.GetComponent <BlockBehaviour>();
            if (block == null)
            {
                return;
            }
            BlockFace face = BlockFaceMethods.BlockFaceFromNormal(hit.normal);

            _animator.AttemptToInteractWith(block, face);
        }
    }