Ejemplo n.º 1
0
    private void Awake()
    {
        Icon.material = new Material(Greyscale);
        if (IsOn == false)
        {
            SetDisable();
        }
        Button btn = gameObject.GetComponent <Button>();

        btn.onClick.RemoveAllListeners();
        btn.onClick.AddListener(OnClicked);
        Group = transform.parent.gameObject.GetComponent <BetterToggleGroup>();
    }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        levelCount  = GameObject.Find("LevelsScrollbar").transform.GetChild(0).transform.GetChild(0).transform.childCount;
        toggleGroup = GameObject.Find("LevelsScrollbar").transform.GetChild(0).transform.GetChild(0).GetComponent <BetterToggleGroup>();

        playerPanelGroup = GameObject.Find("PlayerPanel").transform.GetChild(1).GetComponent <BetterToggleGroup>();

        Debug.Log("Level count: " + levelCount);

        toggleGroup.OnChange      += ChangeLevelIndex;
        playerPanelGroup.OnChange += ChangePlayerCount;
        player1Team = GameObject.Find("Player1Team").GetComponent <BetterToggleGroup>();
        player2Team = GameObject.Find("Player2Team").GetComponent <BetterToggleGroup>();
        player3Team = GameObject.Find("Player3Team").GetComponent <BetterToggleGroup>();
        player4Team = GameObject.Find("Player4Team").GetComponent <BetterToggleGroup>();

        gameModeToggleGroup = GameObject.Find("GameMode").GetComponent <BetterToggleGroup>();

        GoalDropDown = GameObject.Find("GoalDropDown");
        TimeDropDown = GameObject.Find("TimeDropDown");

        GoalDropDown.SetActive(true);
        TimeDropDown.SetActive(false);
    }
Ejemplo n.º 3
0
 public void RegisterGroup(BetterToggleGroup group)
 {
     _group = group;
 }
Ejemplo n.º 4
0
 void OnMouseDrag()
 {
     // Get the click location.
     Vector3 newScreenPoint = new Vector3(Input.mousePosition.x, Input.mousePosition.y, screenPoint.z);
     if (newScreenPoint.x == previousPoint.x) return;
     var isAreaIncreasing = newScreenPoint.x > previousPoint.x;
     Debug.Log("Area is "+ (isAreaIncreasing ? "increasing" : "decreasing"));
     // Adjust the location by adding an offset.
     Vector3 newPosition = Camera.main.ScreenToWorldPoint(newScreenPoint) + offset;
     if (newPosition.x >= 4.82f)
     {
         newPosition.Set(4.82f, 0, 0);
     }
     if (newPosition.x <= -5f)
     {
         newPosition.Set(-5f, 0, 0);
     }
     newPosition.Set(newPosition.x, 0, 0);
     // Assign new position.
     transform.position = newPosition;
     if (FluxDirectionTglGroup == null)
     {
         FluxDirectionTglGroup = GameObject.Find(Main.StrIdTglGroupFluxDirection).GetComponent<BetterToggleGroup>();
     }
     var tglDirection = FluxDirectionTglGroup.Active();
     if (!FluxDirectionTglGroup.FluxDirectionIsInOrOutOfPage()) {
         return;
     }
     // Debug.Log("Flux is directed " + (FluxDirectionTglGroup.IsFluxDirectedIntoPage() ?
     //     "into" : "out of") + "the page");
     // if area is increasing
     if (isAreaIncreasing) {
         // if the arrows are pointing down
         if (FluxDirectionTglGroup.IsFluxDirectedIntoPage()) {
             // current is counter clockwise
             GenerateCurrentArrows(false);
         }
         else {
             GenerateCurrentArrows(true);
         }
     }
     else {
         // area is decreasing
         // if the arrows are pointing down
         if (FluxDirectionTglGroup.IsFluxDirectedIntoPage()) {
             // current is counter clockwise
             GenerateCurrentArrows(true);
         }
         else {
             GenerateCurrentArrows(false);
         }
     }
     previousPoint = newScreenPoint;
 }