66 * $Notice: See LICENSE.txt for modification and distribution information
77 * Copyright (c) 2016 by Shen, Jen-Chieh $
88 */
9+
10+ /*
11+ * If you had purchase a copy of 'SpriteMask' and willing to use this
12+ * component, uncomment a line below.
13+ *
14+ * SpriteMask: https://assetstore.unity.com/packages/tools/sprite-management/sprite-mask-27642
15+ */
16+ //#define SPRITE_MASK
17+
918using UnityEngine ;
1019using System . Collections ;
1120
1221
1322namespace JCSUnity
1423{
15-
1624 /// <summary>
1725 /// if finding for 2D Liquid bar to do the health bar effect,
1826 /// plz use the "JCS_GUILiquidBar" instead.
@@ -34,11 +42,13 @@ public class JCS_3DLiquidBar
3442 private Vector3 mMaskTargetPosition = Vector3 . zero ;
3543
3644
45+ #if ( SPRITE_MASK )
3746 [ Header ( "** Initilaize Variables (JCS_3DLiquidBar) **" ) ]
3847
3948 [ Tooltip ( "Plz set this." ) ]
4049 [ SerializeField ]
4150 private SpriteMask mSpriteMask = null ;
51+ #endif
4252
4353 [ Tooltip ( "Plz put the under texture bar here." ) ]
4454 [ SerializeField ]
@@ -297,6 +307,7 @@ private void GetContainerData()
297307 if ( mBarSpriteRenderer == null )
298308 return ;
299309
310+ #if ( SPRITE_MASK )
300311 // find the width and height of the image from sprite renderer
301312 Vector2 maskSize = mSpriteMask . size ;
302313
@@ -330,6 +341,7 @@ private void GetContainerData()
330341 }
331342 break ;
332343 }
344+ #endif
333345
334346 // do starting percent
335347 FixPercentage ( ) ;
@@ -374,8 +386,10 @@ private void FixPercentage()
374386 /// </summary>
375387 private void TowardToTargetValue ( )
376388 {
389+ #if ( SPRITE_MASK )
377390 Vector3 speed = ( mMaskTargetPosition - mSpriteMask . transform . localPosition ) / mDeltaFriction * Time . deltaTime ;
378391 mSpriteMask . transform . localPosition += speed ;
392+ #endif
379393 }
380394
381395 /// <summary>
0 commit comments