static public UIhandler Get(GameObject go) { UIhandler listener = go.GetComponent <UIhandler>(); if (listener == null) { listener = go.AddComponent <UIhandler>(); } return(listener); }
void Awake() { if (UI == null) { DontDestroyOnLoad(gameObject); UI = this; } else if (UI != this) { Destroy(gameObject); } }
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); }
void Start() { /*if (handler == null) * { * DontDestroyOnLoad(gameObject); * handler = this; * } * else if (handler != this) * { * Destroy(gameObject); * }*/ collScript = FindObjectOfType <Collector> (); handler = this; UpdateTorches(startTorch); }
void Start() { /*if (handler == null) { DontDestroyOnLoad(gameObject); handler = this; } else if (handler != this) { Destroy(gameObject); }*/ collScript = FindObjectOfType<Collector> (); handler = this; UpdateTorches (startTorch); }
// Use this for initialization void Start() { currentLane = lanes.middle; GameControllerScript = GameObject.Find("GameScripts").GetComponent <GameController>(); UIhandlerScript = GameObject.Find("UI").GetComponent <UIhandler>(); }
private void Start() { UIhandler.Get(bar.gameObject).onDown = Select; UIhandler.Get(bar.gameObject).onDrag = Select; }