예제 #1
0
 public MeshMask(MeshMaskParameters parameters)
 {
     _isActive = parameters.IsActive;
     _position = parameters.Position;
     _size     = parameters.Size;
     _arePositionAndSizeLocked = parameters.ArePositionAndSizeLocked;
     _controlPoints            = parameters.ControlPoints;
     _subdivisions             = parameters.Subdivisions;
 }
예제 #2
0
        internal void Validate(MeshMaskParameters parameters)
        {
            _isActive = parameters.IsActive;
            _arePositionAndSizeLocked = parameters.ArePositionAndSizeLocked;
            _subdivisions             = Mathf.Clamp(parameters.Subdivisions, 0, int.MaxValue);
            _position = parameters.Position;
            _size     = parameters.Size;

            UpdatePositionAndScale();

            if (!Application.isPlaying)
            {
                SetupMesh();

                var position = _arePositionAndSizeLocked ? _position : _mainModule.Position;

                _maskBefore.transform.position = position + Vector3.forward * MASK_Z_OFFSET;
                _maskAfter.transform.position  = position + Vector3.back * MASK_Z_OFFSET;

                _maskBefore.transform.localScale = _maskAfter.transform.localScale = _arePositionAndSizeLocked ? _size : new Vector3(_mainModule.Width, _mainModule.Height, 1f);
            }
        }