示例#1
0
    void OnTetherHeadClick(TetherHead t)
    {
        if (t.Locked)
        {
            return;
        }
        SetCurrentHead(t);
        PlayerPrefs.SetInt("CurrentTetherHeadID", t.ID);

        GameObject[] tetherHeads = GameObject.FindGameObjectsWithTag("UI/Head");
        foreach (GameObject g in tetherHeads)
        {
            TetherHead tt = g.GetComponent <TetherHead>();
            if (!tt.Locked)
            {
                if (tt.ID != Current.ID)
                {
                    tt.HideBackground();
                }
                else
                {
                    tt.ShowBackground();
                }
            }
        }
    }
示例#2
0
    public void SetCurrentHead(TetherHead t)
    {
        if (t == null)
        {
            Debug.Log("t is null");
            return;
        }

        Current = t;
    }
示例#3
0
    public override void OnPointerClick(PointerEventData data)
    {
        if (GameplayController.GAME_STATE == State.MENU)
        {
            if (buttonID == ButtonID.STARTAREA)
            {
                if (!ShopPanel.ACTIVE)
                {
                    mouseUp = data.position;

                    float mag = Mathf.Abs(mouseUp.x - mouseDown.x);

                    if (mag < Screen.width * .1f)
                    {
                        FindObjectOfType <LevelSelectUI>().StartGame();
                    }
                }
                else
                {
                    FindObjectOfType <ShopPanel>().Close();
                }
            }
        }

        switch (buttonID)
        {
        case ButtonID.PAUSEMENU:
        {
            if (EventManager.OnGameOver != null)
            {
                EventManager.OnGameOver();
            }
            break;
        }

        case ButtonID.SHOP:
        {
            FindObjectOfType <ShopButtonHandler>().ShopPanel.Open();
            break;
        }

        case ButtonID.TETHER_HEAD:
        {
            if (EventManager.OnTetherHeadClick != null)
            {
                TetherHead t = GetComponent <TetherHead>();
                EventManager.OnTetherHeadClick(t);
            }
            break;
        }
        }
    }
示例#4
0
    void AddTetherHeads()
    {
        for (int i = 0; i < tetherHeadParent.childCount; i++)
        {
            TetherHead tt = tetherHeadParent.GetChild(i).GetComponent <TetherHead>();
            tt.transform.name = "Head_" + i;
            tt.ID             = i;
            TetherHeads.Add(tt);
        }

        foreach (TetherHead t in TetherHeads)
        {
            t.Init();
            t.CheckForIsLocked();
        }
    }