Guest User

Untitled

a guest
Dec 16th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.51 KB | None | 0 0
  1. /// <summary>
  2.     /// Возвращает GameObject
  3.     /// </summary>
  4.     /// <param name="objectType">Тип контрола</param>
  5.     /// <param name="index">Индекс контрола</param>
  6.     public GameObject this[ControlType objectType, int index]
  7.     {        
  8.         get
  9.         {
  10.             switch (objectType)
  11.             {
  12.                 case ControlType.Tumbler:
  13.                     return tumblers[index];
  14.  
  15.                 case ControlType.Spinner:
  16.                     return spinners[index];
  17.  
  18.                 case ControlType.Indicator:
  19.                     return indicators[index];
  20.  
  21.                 case ControlType.Joystick:
  22.                     return joysticks[index];
  23.  
  24.                 default:
  25.                     Debug.Log("Cant recognize panel object type [" + objectType + "]");
  26.                     return null;
  27.             }
  28.         }
  29.  
  30.         set
  31.         {
  32.             switch (objectType)
  33.             {
  34.                 case ControlType.Tumbler:
  35.                     tumblers[index] = value; break;
  36.  
  37.                 case ControlType.Spinner:
  38.                     spinners[index] = value; break;
  39.  
  40.                 case ControlType.Indicator:
  41.                     indicators[index] = value; break;
  42.  
  43.                 case ControlType.Joystick:
  44.                     joysticks[index] = value; break;
  45.  
  46.                 default:
  47.                     Debug.Log("Cant recognize panel object type [" + objectType + "]");
  48.                     break;
  49.             }
  50.         }
  51.     }
Add Comment
Please, Sign In to add comment