Пример #1
0
    public void OnSetup()
    {
        ballsLeft = ballNumberToUnlock;
        Vector3 textPos = transform.localPosition + transform.InverseTransformDirection(transform.forward) * (meshRenderer.bounds.size.z / 2.05f);

        textPos          += Vector3.up * (meshRenderer.bounds.size.y / 2f);
        textPos.y        += 0.65f;
        lockerTextControl = PoolManager.Instance.GetLockerTextControl();
        lockerTextControl.transform.SetParent(transform.parent);
        lockerTextControl.transform.localEulerAngles = Vector3.zero;
        lockerTextControl.transform.localPosition    = textPos;
        lockerTextControl.gameObject.SetActive(true);
        lockerTextControl.OnUpdateText(ballsLeft);
    }
Пример #2
0
    /// <summary>
    /// Get an inactive LockerTextController object.
    /// </summary>
    /// <returns></returns>
    public LockerTextController GetLockerTextControl()
    {
        //Find in the list
        LockerTextController textObjext = listLockerTextControl.Where(a => !a.gameObject.activeInHierarchy).FirstOrDefault();

        if (textObjext == null)
        {
            //Did not find one -> create new one
            textObjext = Instantiate(lockerTextControlPrefab, Vector3.zero, Quaternion.identity);
            textObjext.gameObject.SetActive(false);
            listLockerTextControl.Add(textObjext);
        }

        return(textObjext);
    }