void UpdateDirection()
 {
     if (!touch.IsCameraToggled())
     {
         SetDirection(touch.GetDirection() / 2);
     }
 }
Example #2
0
    void DisplayDirectionPress()
    {
        Vector2 direction = touchDpadManager.GetDirection();

        if (direction.x > 0)
        {
            isEnabled[E] = true;
            isEnabled[W] = false;
        }
        if (direction.x < 0)
        {
            isEnabled[W] = true;
            isEnabled[E] = false;
        }
        if (direction.y > 0)
        {
            isEnabled[N] = true;
            isEnabled[S] = false;
        }
        if (direction.y < 0)
        {
            isEnabled[N] = false;
            isEnabled[S] = true;
        }
        if (direction.x == 0)
        {
            isEnabled[E] = false;
            isEnabled[W] = false;
        }
        if (direction.y == 0)
        {
            isEnabled[N] = false;
            isEnabled[S] = false;
        }

        for (int i = 0; i < isEnabled.Length; i++)
        {
            if (isEnabled[i])
            {
                panels[i].enabled = true;
            }
            else
            {
                panels[i].enabled = false;
            }
        }
    }