Exemplo n.º 1
0
    public void ProcessDrag(TouchUserInput tui)
    {
        if (tui.InputState == TouchUserInput.State.Down)
        {
            points[0].x = tui.InputWorldPosLastDown.x;
            points[0].y = tui.InputWorldPosLastDown.y;
            points[1].x = tui.InputWorldPos.x;
            points[1].y = tui.InputWorldPos.y;

            linerenderer.SetPositions(points);
            linerenderer.enabled = true;
        }
        else if (tui.InputState == TouchUserInput.State.Drag)
        {
            points[0].x = tui.InputWorldPosLastDown.x;
            points[0].y = tui.InputWorldPosLastDown.y;
            points[1].x = tui.InputWorldPos.x;
            points[1].y = tui.InputWorldPos.y;

            linerenderer.SetPositions(points);
        }
        else if (tui.InputState == TouchUserInput.State.None)
        {
            linerenderer.enabled = false;
        }
    }
Exemplo n.º 2
0
 public void TogglePrediction(TouchUserInput tui)
 {
     if (tui.InputState == TouchUserInput.State.None)
     {
         isPredicting = false;
         return;
     }
     isPredicting = true;
 }
Exemplo n.º 3
0
 public void ProcessDrag(TouchUserInput tui)
 {
     if (tui.InputState == TouchUserInput.State.Up)
     {
         hitVector      = tui.InputPos - tui.InputPosLastDown;
         hitValue.Value = hitpower * hitVector;
     }
     else if (tui.InputState == TouchUserInput.State.Up)
     {
         ballRb2D.AddForce(hitValue.Value, ForceMode2D.Impulse);
         hitValue.Value = Vector2.zero;
     }
 }