Пример #1
0
    public void play()
    {
        data.Clear();
        bool doSend = false;

        if (mainSlider.value != 0)
        {
            SteccaManager.getInstance().Drag(mainSlider.value);
            data.Add("drag", mainSlider.value.ToString());
            doSend = true;
        }
        else
        {
            data.Add("drag", "0");
        }

        if (Input.GetMouseButtonDown(1))
        {
            SteccaManager.getInstance().Reset();
            data.Add("reset", "1");
            doSend = true;
        }
        else
        {
            data.Add("reset", "0");
        }

        if (Input.GetMouseButton(1))
        {
            float   delta = Input.GetAxis("Mouse X") * sensitivityHor;
            Vector3 dir   = Quaternion.Euler(0, delta, 0) * Vector3.forward;
            SteccaManager.getInstance().Rotate(delta);
            //SteccaManager.getInstance().Rotate(dir);
            data.Add("rotation", delta.ToString());
            doSend = true;
        }
        else
        {
            data.Add("rotation", "0");
        }


        if (tira)
        {
            SteccaManager.getInstance().Tira();
            lastValue        = mainSlider.value;
            mainSlider.value = 0;
            tira             = false;
            data.Add("tira", "1");
            doSend = true;
        }
        else
        {
            data.Add("tira", "0");
        }
        if (doSend)
        {
            client.SendMessage(data);
        }
    }
Пример #2
0
    public void watch(Dictionary <String, String> control)
    {
        control.TryGetValue("drag", out String drag);
        control.TryGetValue("reset", out String reset);
        control.TryGetValue("rotation", out String rotation);
        control.TryGetValue("tira", out String tiraSt);
        if (drag != "0")
        {
            SteccaManager.getInstance().Drag(float.Parse(drag));
        }

        if (reset == "1")
        {
            SteccaManager.getInstance().Reset();
        }

        if (rotation != "0")
        {
            float delta = float.Parse(rotation);
            SteccaManager.getInstance().Rotate(delta);
        }
        if (tiraSt == "1")
        {
            SteccaManager.getInstance().Tira();
            tira = false;
        }
        data.Clear();
    }
Пример #3
0
 public void Update()
 {
     if (SteccaManager.getInstance().enabled)
     {
         if (isPlaing)
         {
             play();
         }
         else
         {
             if (data.Count > 3)
             {
                 SteccaManager.getInstance().Reset();
                 watch(data);
             }
         }
     }
 }
Пример #4
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (isOpen)
     {
         SteccaManager.getInstance().enabled = true;
         RectTransformUtility.ScreenPointToLocalPointInRectangle(_screenRectTransform, eventData.position, null, out Vector2 localClick);
         localClick.y = (_screenRectTransform.rect.yMin * -1) - (localClick.y * -1);
         Vector2 viewportClick = new Vector2(localClick.x / _screenRectTransform.rect.xMax, localClick.y / (_screenRectTransform.rect.yMax));
         Ray     ray           = mapCamera.ViewportPointToRay(new Vector3(viewportClick.x, viewportClick.y, 0));
         if (Physics.Raycast(ray, out RaycastHit hit))
         {
             battente.position = hit.point;
         }
     }
     else
     {
         SteccaManager.getInstance().enabled = false;
     }
     anim.SetTrigger("Operate");
     isOpen = !isOpen;
 }
Пример #5
0
 private void Awake()
 {
     anim = GetComponent <Animator>();
     _screenRectTransform = GetComponent <RectTransform>();
     battente             = SteccaManager.getInstance().battente;
 }
Пример #6
0
 public void continuaTurno()
 {
     SteccaManager.getInstance().Reset();
     inBuca = false;
     Debug.Log("current player P" + currentPlayer.n);
 }