Example #1
0
    private void _InstantiateMiniCubes(Vector3Int position, Vector3Int rotation)
    {
        MiniCube newMiniCube = Instantiate(miniCube, position, Quaternion.Euler(rotation));

        newMiniCube.xyz = position;
        newMiniCube.transform.parent = _miniCubeParent.transform;
        _miniCubes.Add(newMiniCube);
    }
Example #2
0
    private Vector3Int GetCubeRotation(MiniCube miniCubePos = null)
    {
        if (miniCubePos == null)
        {
            miniCubePos = _miniCubeSelected;
        }

        Vector3Int rowColumnDepth = Vector3Int.zero;

        rowColumnDepth.x = Mathf.RoundToInt(miniCubePos.transform.eulerAngles.x);
        rowColumnDepth.y = Mathf.RoundToInt(miniCubePos.transform.eulerAngles.y);
        rowColumnDepth.z = Mathf.RoundToInt(miniCubePos.transform.eulerAngles.z);
        return(rowColumnDepth);
    }
Example #3
0
    private void Update()
    {
        if (InputManager.Instance.GetMouseOrTouchBegin())
        {
            if (EventSystem.current.IsPointerOverGameObject())
            {
                return;
            }

            var cubeFound = RaycastingMask(MINI_CUBE_LAYER_MASK);

            if (cubeFound != null)
            {
                _MiniCubeSelected = cubeFound.GetComponent <MiniCube>();
            }
            else
            {
                // If we clicked elsewhere
                _MiniCubeSelected = null;
            }
        }
    }