Inheritance: MonoBehaviour
Example #1
0
    static public UIhandler Get(GameObject go)
    {
        UIhandler listener = go.GetComponent <UIhandler>();

        if (listener == null)
        {
            listener = go.AddComponent <UIhandler>();
        }
        return(listener);
    }
Example #2
0
 void Awake()
 {
     if (UI == null)
     {
         DontDestroyOnLoad(gameObject);
         UI = this;
     }
     else if (UI != this)
     {
         Destroy(gameObject);
     }
 }
Example #3
0
    private void Start()
    {
        UIhandler.Get(colorPadImg.gameObject).onDown = Select;
        UIhandler.Get(colorPadImg.gameObject).onDrag = Select;

        Vector3       pos       = Selector.transform.localPosition;
        RectTransform rectTrans = colorPadImg.GetComponent <RectTransform>();
        Image         img       = colorPadImg.GetComponent <Image>();
        float         pixelX    = ((pos.x + rectTrans.sizeDelta.x / 2) / rectTrans.sizeDelta.x) /* * img.sprite.texture.width*/;
        float         pixelY    = ((pos.y + rectTrans.sizeDelta.y / 2) / rectTrans.sizeDelta.y) /* * img.sprite.texture.height*/;

        //Color color = img.sprite.texture.GetPixel((int)pixelX, (int)pixelY);
        FreshColor(pixelX, pixelY);
    }
Example #4
0
 void Start()
 {
     /*if (handler == null)
      * {
      *  DontDestroyOnLoad(gameObject);
      *  handler = this;
      * }
      * else if (handler != this)
      * {
      *  Destroy(gameObject);
      * }*/
     collScript = FindObjectOfType <Collector> ();
     handler    = this;
     UpdateTorches(startTorch);
 }
Example #5
0
 void Start()
 {
     /*if (handler == null)
     {
         DontDestroyOnLoad(gameObject);
         handler = this;
     }
     else if (handler != this)
     {
         Destroy(gameObject);
     }*/
     collScript = FindObjectOfType<Collector> ();
     handler = this;
     UpdateTorches (startTorch);
 }
Example #6
0
 // Use this for initialization
 void Start()
 {
     currentLane          = lanes.middle;
     GameControllerScript = GameObject.Find("GameScripts").GetComponent <GameController>();
     UIhandlerScript      = GameObject.Find("UI").GetComponent <UIhandler>();
 }
Example #7
0
 private void Start()
 {
     UIhandler.Get(bar.gameObject).onDown = Select;
     UIhandler.Get(bar.gameObject).onDrag = Select;
 }