Example #1
0
    private IEnumerator openCo()
    {
        buttonOnHomeMenu.transform.localScale = Vector3.zero;

        VerticalCarouselScroller.Instance.GoToButton(transform.GetSiblingIndex());

        print("_distanceToCenter[transform.GetSiblingIndex()] " + VerticalCarouselScroller.Instance._distanceToCenter[transform.GetSiblingIndex()]);
        yield return(new WaitForSeconds(VerticalCarouselScroller.Instance._distanceToCenter[transform.GetSiblingIndex()] / 800f));

        VerticalCarouselScroller.Instance.scrollRect.enabled = false;

        _cloneHweel = Instantiate(this);

        _cloneHweel.parentHweel = this;

        _cloneHweel.transform.SetParent(CanvasForHweels.Instance.transform);
        CanvasForHweels.Instance.currentHweel = _cloneHweel;

        _cloneHweel.transform.position   = this.transform.position;
        _cloneHweel.transform.localScale = this.transform.localScale;
        //cloneHweel.transform.localScale = Vector3.one;
        _cloneHweel.transform.DOScale(Vector3.one, animationSpeed);
        _cloneHweel.outerCircleMask.transform.DOMove(CenterOfScreen.Instance.transform.position, animationSpeed);
        _cloneHweel.outerCircleMask.DOSizeDelta(outerCircleOpenPos, animationSpeed);
    }
Example #2
0
    void Start()
    {
        hweel = CanvasForHweels.Instance.currentHweel;

        Time.timeScale = 10;

        direction = new Vector3(0, 0, 1);

        rotationSpeed = 360f / hweel.workout.totalSeconds;

        currentExercise = hweel.workout.exercises[0];

        timeRemaining = currentExercise.timeToComplete;

        _colorIndex = 0;

        UpdateColor();
    }
    public void GetItemClosestToCenter()
    {
        Hweel   centermostItem     = null;
        float   closestDistanceSqr = Mathf.Infinity;
        Vector3 currentPosition    = transform.position;

        foreach (Hweel potentialItem in _hweels)
        {
            Vector3 directionToTarget = potentialItem.transform.position - currentPosition;
            float   dSqrToTarget      = directionToTarget.sqrMagnitude;

            if (dSqrToTarget < closestDistanceSqr)
            {
                closestDistanceSqr = dSqrToTarget;
                centermostItem     = potentialItem;
            }
        }

        activeHweel = centermostItem;
        //return centermostItem;
    }