public void paint(TouchpadControllerType touchpad)
    {
        //are we touching
        if (touchpad.IS_TOUCHING)
        {
            //values coming in are normalized put them back
            drawPositionX = Mathf.Floor(touchpad.POSITION_HORIZONTAL * canvasWidth);
            drawPositionY = Mathf.Floor(touchpad.POSITION_VERTICAL * canvasHeight);

            //create prefab paint object
            currentObject = Instantiate(paintObject);
            currentRT     = currentObject.GetComponent <RectTransform>();
            currentImage  = currentObject.GetComponent <Image>();

            currentRT.transform.SetParent(panel.transform, false);
            currentRT.anchoredPosition = new Vector2(drawPositionX, drawPositionY);
            currentImage.color         = currentColor;
        }
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Awake()
 {
     touchpadKey   = EasyWiFiController.registerControl(EasyWiFiConstants.CONTROLLERTYPE_TOUCHPAD, controlName);
     touchpad      = (TouchpadControllerType)EasyWiFiController.controllerDataDictionary[touchpadKey];
     touchpadImage = gameObject.GetComponent <Image>();
 }