Advertisement
Guest User

Untitled

a guest
Jul 6th, 2018
408
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //@input Component.SpriteVisual dayOfWeekSprite
  2.  
  3. //@ui {"widget": "separator"}
  4.  
  5. //@input Asset.Texture sundayTexture
  6. //@input Asset.Texture mondayTexture
  7. //@input Asset.Texture tuesdayTexture
  8. //@input Asset.Texture wednesdayTexture
  9. //@input Asset.Texture thursdayTexture
  10. //@input Asset.Texture fridayTexture
  11. //@input Asset.Texture saturdayTexture
  12.  
  13. var date = new Date();
  14. var day = date.getDay();
  15.  
  16. switch( day )
  17. {
  18.     case 0:
  19.         print( "Sunday" );
  20.         setSpriteTexture(script.dayOfWeekSprite, script.sundayTexture);
  21.         break;
  22.     case 1:
  23.         print( "Monday" );
  24.         setSpriteTexture(script.dayOfWeekSprite, script.mondayTexture);
  25.         break;
  26.     case 2:
  27.         print( "Tuesday" );
  28.         setSpriteTexture(script.dayOfWeekSprite, script.tuesdayTexture);
  29.         break;
  30.     case 3:
  31.         print( "Wednesday" );
  32.         setSpriteTexture(script.dayOfWeekSprite, script.wednesdayTexture);
  33.         break;
  34.     case 4:
  35.         print( "Thursday" );
  36.         setSpriteTexture(script.dayOfWeekSprite, script.thursdayTexture);
  37.         break;
  38.     case 5:
  39.         print( "Friday" );
  40.         setSpriteTexture(script.dayOfWeekSprite, script.fridayTexture);
  41.         break;
  42.     case 6:
  43.         print( "Saturday" );
  44.         setSpriteTexture(script.dayOfWeekSprite, script.saturdayTexture);
  45.         break;
  46. }
  47.  
  48. function setSpriteTexture(sprite, texture)
  49. {
  50.     if(sprite && texture){
  51.         script.dayOfWeekSprite.mainMaterial.mainPass.baseTex = texture;
  52.     }
  53. }
Advertisement
RAW Paste Data Copied
Advertisement