FaceButton GetFaceButton(Vector2 pos)
        {
            float x = pos.x;
            float y = pos.y;

            FaceButton facebutton = FaceButton.TrackpadUp;

            if (CheckRadius(pos))
            {
                return(facebutton);
            }

            float angle = Vector2.Angle(Vector2.right, pos);

            if (angle < 45 && x > 0)
            {
                facebutton = FaceButton.TrackpadRight;
            }
            else if (angle > 45 && angle < 135 && y > 0)
            {
                facebutton = FaceButton.TrackpadUp;
            }
            else if (x < 0 && (angle > 135 && angle < 180))
            {
                facebutton = FaceButton.TrackpadLeft;
            }
            else if (angle > 45 && angle < 135 && y < 0)
            {
                facebutton = FaceButton.TrackpadDown;
            }

            Debug.Log("angle - button" + angle + ":" + facebutton.ToString());

            return(facebutton);
        }
 void DoFaceButtonPressed(FaceButton facebutton)
 {
     if (facebutton == FaceButton.TrackpadLeft)
     {
         WellPathManager.Instance.RotateWellPath(true);
     }
     else if (facebutton == FaceButton.TrackpadRight)
     {
         WellPathManager.Instance.RotateWellPath(false);
     }
     else if (facebutton == FaceButton.TrackpadUp)
     {
         WellPathManager.Instance.MoveWellPath(false);
     }
     else if (facebutton == FaceButton.TrackpadDown)
     {
         WellPathManager.Instance.MoveWellPath(true);
     }
 }
Esempio n. 3
0
    protected override void pushed()
    {
        string[] tAnimalList        = Animal.getAnimalList;
        string   tCurrentAnimalName = getAnimalName();
        //現在表示している動物のインデックス
        int tCurrentIndex;

        for (tCurrentIndex = 0; tCurrentIndex < tAnimalList.Length - 1; tCurrentIndex++)
        {
            if (tCurrentAnimalName == tAnimalList[tCurrentIndex])
            {
                break;
            }
        }
        //被りがないように変更後の動物を探す
        int tToIndex = (tCurrentIndex + 1) % tAnimalList.Length;

        for (; ;)
        {
            bool tIsOvercoat = false;
            for (int i = 1; i < 5; i++)
            {
                GameObject tConfig     = GameObject.Find("player_config" + i);
                FaceButton tFaceButton = tConfig.GetComponentInChildren <FaceButton>();
                if (tAnimalList[tToIndex] == tFaceButton.getAnimalName())
                {
                    tIsOvercoat = true;
                    break;
                }
            }
            if (!tIsOvercoat)
            {
                break;
            }
            tToIndex = (tToIndex + 1) % tAnimalList.Length;
        }
        findChild <SpriteRenderer>("faceImage").sprite = Animal.getFaceImage(tAnimalList[tToIndex]);
    }
Esempio n. 4
0
 public void Paint(FaceButton fb, Color c)
 {
     fb.SetColor(c);
 }
 void DoFaceButtonReleased(FaceButton facebutton)
 {
     if (facebutton == FaceButton.TrackpadRight)
     {
     }
 }