Inheritance: uProcessing
Esempio n. 1
0
    public override Sequence OpeningSequence(IntVector v)
    {
        Transform start = GameManager.UI.ModuleRight;
        Transform end   = GameManager.UI.ModuleTarget;

        if (v.x == 1)
        {
            start = GameManager.UI.ModuleRight;
        }
        else if (v.x == -1)
        {
            start = GameManager.UI.ModuleLeft;
        }
        else
        {
            start = GameManager.UI.ModuleRight;
        }

        MOB.transform.position = start.position;

        Sequence s = Tweens.SwoopTo(MOB.transform, end.position);

        for (int i = 0; i < Frames.Length; i++)
        {
            if (Frames[i] == null)
            {
                continue;
            }
            s.Insert(0.4F, Tweens.PictureSway(Frames[i].transform, new Vector3(0, 0, 12 * v.x)));
        }

        return(s);
    }
Esempio n. 2
0
        public void PanResearch(bool left)
        {
            int numLevels = researchList.transform.childCount;

            researchPannedAmount         += left? 1:-1;
            researchPanRight.interactable = researchPannedAmount > 0;
            researchPanLeft.interactable  = researchPannedAmount < numLevels - 1;
            IEnumerator Pan()
            {
                float xDelta = 100 + researchList.spacing;

                var   rt       = researchList.GetComponent <RectTransform>();
                float x0       = rt.anchoredPosition.x;
                float x1       = -researchPannedAmount * xDelta;
                float duration = .2f;

                float tStart = Time.time;

                while (Time.time < tStart + duration)
                {
                    float x = Mathf.Lerp(x0, x1, Tweens.QuadraticInOut((Time.time - tStart) / duration));
                    rt.anchoredPosition = new Vector2(x, rt.anchoredPosition.y);
                    yield return(null);
                }
                rt.anchoredPosition = new Vector2(x1, rt.anchoredPosition.y);
                researchPanRoutine  = null;
            }

            if (researchPanRoutine != null)
            {
                StopCoroutine(researchPanRoutine);
            }
            StartCoroutine(researchPanRoutine = Pan());
            SetCurrentResearchLeaderboard();
        }
Esempio n. 3
0
    public void SetModule(Module m)
    {
        UIObj newobj = m.MUI;

        if (GameManager.Module != null)
        {
            UIObj oldobj = GameManager.Module.MUI;

            if (GameManager.Module == m)
            {
                return;
            }
            else if (GameManager.Module.Index < m.Index)
            {
                Tweens.SwoopTo(oldobj.transform, ModuleLeft.position).OnComplete(() => oldobj.SetActive(false));
                newobj.transform.position = ModuleRight.position;
            }
            else
            {
                Tweens.SwoopTo(oldobj.transform, ModuleRight.position).OnComplete(() => oldobj.SetActive(false));
                newobj.transform.position = ModuleLeft.position;
            }
        }
        else
        {
            newobj.transform.position = ModuleRight.position;
        }

        Sequence s = Tweens.SwoopTo(m.MUI.transform, ModuleTarget.position);
    }
Esempio n. 4
0
 public void OnPointerUp(PointerEventData eventData)
 {
     if (GameManager.IgnoreInput || !RaycastTarget)
     {
         return;
     }
     if (LogUIObjs)
     {
         print(this + ": Mouse Up - " + Actions_MouseUp.Count + " actions");
     }
     foreach (UIAction_Method child in TypeActions_MouseUp)
     {
         child.Act();
     }
     if ((Actions_MouseUp.Count > 0 || TypeActions_MouseUp.Count > 0) || PlayClickUp)
     {
         //	AudioManager.instance.PlayClipOn(this.transform, "UI", "ClickUp");
     }
     //if(Application.isMobilePlatform) return;
     foreach (Action child in Actions_MouseUp)
     {
         child();
     }
     isPressed = false;
     time_over = 0.0F;
     Tweens.SetToState(this, State_init, 0.1F);
 }
Esempio n. 5
0
        public virtual void TweenActive(bool?active = null)
        {
            bool actual = active ?? !this.gameObject.activeSelf;

            if (actual == this.gameObject.activeSelf)
            {
                return;
            }

            isActive = actual;
            if (actual)
            {
                this.gameObject.SetActive(true);
                if (this.transform.localScale != Vector3.zero)
                {
                    activescale = this.transform.localScale;
                }
                else
                {
                    activescale = Vector3.one;
                }

                this.transform.localScale = Vector3.zero;

                Sequence s = Tweens.Bounce(this.transform, activescale).OnComplete(() => { activescale = this.transform.localScale; });
            }
            else
            {
                this.transform.DOScale(Vector3.zero, 0.25F).OnComplete(() => { this.gameObject.SetActive(false); });
            }
        }
    void SetBounceTween()
    {
        float l_tweenMoveX = Tweens.EaseOutElastic(m_currentTweenDuration, m_ballStartScale.x, m_bounceTweenSetting.ballGrowth, m_bounceTweenSetting.tweenDuration, 0);
        float l_tweenMoveY = Tweens.EaseOutElastic(m_currentTweenDuration, m_ballStartScale.y, m_bounceTweenSetting.ballGrowth, m_bounceTweenSetting.tweenDuration, 0);

        transform.localScale = new Vector3(l_tweenMoveX, l_tweenMoveY);
    }
Esempio n. 7
0
    IEnumerator StartGame()
    {
        EndButton.TweenActive(false);
        EndInfo.TweenActive(false);
        FitnessObj.SetActive(false);

        yield return(new WaitForSeconds(0.4F));

        for (int i = 3; i > 0; i--)
        {
            MUI.Txt[0].text = "" + i;
            Tweens.Bounce(MUI.Txt[0].transform);
            yield return(new WaitForSeconds(0.8F));
        }
        MUI.Txt[0].text = "";
        FitnessObj.TweenActive(true);
        FitnessObj.Img[0].transform.localScale = new Vector3(
            Mathf.Clamp(TargetGrand.Data.Fitness.Max / 200, 0.4F, 2.0F), 1, 1);
        FitnessObj.Img[1].transform.localScale = new Vector3(
            TargetGrand.Data.Fitness.Ratio, 1, 1);
        yield return(new WaitForSeconds(0.1F));

        GameTime = 0.0F;
        Running  = true;
    }
Esempio n. 8
0
    public void OnPointerDown(PointerEventData eventData)
    {
        if (GameManager.IgnoreInput || !RaycastTarget)
        {
            return;
        }
        if (LogUIObjs)
        {
            print(this + ": Mouse Down - " + Actions_MouseDown.Count + " actions");
        }

        if ((Actions_MouseUp.Count > 0 || TypeActions_MouseUp.Count > 0) || PlayClickDown)
        {
            //	AudioManager.instance.PlayClipOn(this.transform, "UI", "ClickDown");
        }

        foreach (Action child in Actions_MouseDown)
        {
            child();
        }
        foreach (UIAction_Method child in TypeActions_MouseDown)
        {
            child.Act();
        }

        isPressed  = true;
        time_over += Time.deltaTime;
        Tweens.SetToState(this, StateWhenPressed);
    }
Esempio n. 9
0
    public virtual Sequence OpeningSequence(IntVector v)
    {
        Transform start = GameManager.UI.ModuleRight;
        Transform end   = GameManager.UI.ModuleTarget;

        if (v.x == 1)
        {
            start = GameManager.UI.ModuleRight;
        }
        else if (v.x == -1)
        {
            start = GameManager.UI.ModuleLeft;
        }
        else
        {
            start = GameManager.UI.ModuleRight;
        }

        MOB.transform.position = start.position;

        Sequence s = Tweens.SwoopTo(MOB.transform, end.position);

        Sequence f = DOTween.Sequence();

        f.Append(MUI[7].transform.DOLocalRotate(new Vector3(0, 25, 0), 0.1F));
        f.Append(MUI[7].transform.DOLocalRotate(new Vector3(0, 35, 0), 0.2F));
        f.Append(MUI[7].transform.DOLocalRotate(new Vector3(0, 0, 0), 0.15F));
        f.Insert(0.0F, Tweens.PictureSway(MUI["thirdeye"].transform, new Vector3(0, 0, 12 * v.x)));

        s.Insert(0.35F, f);

        return(s);
    }
Esempio n. 10
0
    public IEnumerator Win()
    {
        Running = false;

        MOB[1].transform.position = EndPoint.position;
        EndInfo.TweenActive(true);
        EndInfo.Txt[0].text = "SAFE!";

        yield return(new WaitForSeconds(0.7F));

        EndInfo.Txt[0].text = "FITNESS UP: " + (TargetGrand.Data.Fitness.RatioToString()) + "%";
        Tweens.Bounce(EndInfo.Txt[0].transform);

        yield return(new WaitForSeconds(Time.deltaTime * 40));

        int fit = 30 + (int)Mathf.Clamp(50 - GameTime, 0, 30);

        TargetGrand.Data.Fitness.Add(fit);

        EndInfo.Txt[0].text = "FITNESS UP: " + (TargetGrand.Data.Fitness.RatioToString()) + "%";
        Tweens.Bounce(EndInfo.Txt[0].transform);

        yield return(new WaitForSeconds(Time.deltaTime * 40));

        int rep = fit;

        StartCoroutine(GameManager.UI.ResourceAlert(GameManager.WorldRes.Rep, rep));
        EndInfo.Txt[0].text = "REP UP: " + rep;
        Tweens.Bounce(EndInfo.Txt[0].transform);

        EndButton.TweenActive(true);
    }
        public void StopReaching(float tweenDuration = 1, bool disable = false)
        {
            if (InitReady)
            {
                Init();
            }
            if (!isReaching)
            {
                return;
            }
            isReaching = false;
            reach      = false;
            Action callback = null;

            if (disable)
            {
                callback = () => ResetAndDisable();
            }
            // If this is the first time we tween, "from" value has to be provided, because by default it's 0, which is not what we want in this case.
            if (Tweens.ContainsKey(tweenId))
            {
                TweenTo(tweenId, to: 0, duration: tweenDuration, easing: tweenMode, updateCallback: value => targetWeight = value, readyCallback: callback);
            }
            else
            {
                TweenTo(tweenId, to: 0, from: targetWeight, duration: tweenDuration, easing: tweenMode, updateCallback: value => targetWeight = value, readyCallback: callback);
            }
        }
Esempio n. 12
0
 void Start()
 {
     Tweens.Sequence(
         Tweens.Parallel(
             Tweens.Delay(5)
             .Then(Tweens.Fade(objA, 1, 0, 2)
                   .SetLoopType(TweenDuration.LoopType.Pingpong)
                   .SetRepeat(1),
                   Tweens.ScaleBy(objA, new Vector3(2, 2, 1), 2)
                   .SetLoopType(TweenDuration.LoopType.Pingpong)
                   .SetRepeat(1)),
             Tweens.Delay(3)
             .Then(Tweens.MoveAdd(objB, new Vector3(0, 5, 0), 2)
                   .SetLoopType(TweenDuration.LoopType.Pingpong)
                   .SetRepeat(2))
             ),
         Tweens.Parallel(
             Tweens.RotateAdd(objA, new Vector3(0, 0, 360), 3)
             .SetLoopType(TweenDuration.LoopType.Pingpong)
             .SetRepeat(1),
             Tweens.RotateAdd(objB, new Vector3(0, 0, 360), 3)
             .SetLoopType(TweenDuration.LoopType.Pingpong)
             .SetRepeat(1))
         )
     .SetRepeat(2)
     .OnStart(() => Debug.Log("Start!"))
     .OnComplete(() => Debug.Log("Finished!"))
     .Begin();
 }
Esempio n. 13
0
    public void SetupFace(Face f, FIRL frame, GrandData g)
    {
        f.AddAction(TouchAction.Up, () =>
        {
            if (ginfo_target != g)
            {
                if (ginfo != null)
                {
                    ginfo.PoolDestroy();
                }
                ginfo_face   = f;
                ginfo_target = g;
                ginfo        = GameManager.UI.GrandInfo(g);
                Vector3 pos  = new Vector3(this.transform.position.x, f.transform.position.y - 10, 0.0F);
                ginfo.SetUIPositionFromWorld(pos);
                ginfo.FitOnScreen();
                ginfo.SetActive(false);
                ginfo.TweenActive(true);

                lastsmiles = g.Smiles.Value;
                lastgrumps = g.Grumps.Value;
                Tweens.Bounce(f.transform);
            }
            else if (ginfo != null)
            {
                ginfo.PoolDestroy();
                ginfo_target = null;
            }
        });
    }
Esempio n. 14
0
    public IEnumerator LoadModuleUI(Module m, IntVector v)
    {
        UIObj     mui   = m.MUI;
        Transform start = ModuleRight;
        Transform end   = ModuleTarget;

        if (v.x == 1)
        {
            start = ModuleRight;
        }
        else if (v.x == -1)
        {
            start = ModuleLeft;
        }
        else
        {
            start = ModuleRight;
        }

        mui.transform.position = start.position;

        Sequence s = Tweens.SwoopTo(mui.transform, end.position);

        yield return(s.WaitForCompletion());
    }
Esempio n. 15
0
        public void UnincubateAndRelease()
        {
            StartCoroutine(Grow(0));
            incubatedObj = null;
            StartCoroutine(Release());
            IEnumerator Release(float duration = .5f)
            {
                float tStart      = Time.time;
                float xEuler      = pickupZone.transform.localRotation.eulerAngles.x;
                float yEuler      = pickupZone.transform.localRotation.eulerAngles.y;
                Color dropZoneCol = dropZone.color;

                dropZoneCol.a  = .5f;
                dropZone.color = dropZoneCol;
                while (Time.time < tStart + duration)
                {
                    float t = Tweens.QuadraticInOut((Time.time - tStart) / duration);
                    pickupZone.transform.localRotation = Quaternion.Euler(xEuler, yEuler, t * 360);
                    dropZoneCol.a  = Mathf.Lerp(.5f, 0, Tweens.CubicInOut(t));
                    dropZone.color = dropZoneCol;
                    yield return(null);
                }
                pickupZone.transform.localRotation = Quaternion.Euler(xEuler, yEuler, 0);
                dropZoneCol.a  = 0;
                dropZone.color = dropZoneCol;
            }
        }
Esempio n. 16
0
            public void ReturnsTweens()
            {
                // Arrange -> Act
                var tweens = new Tweens();

                // Assert
                Assert.IsAssignableFrom <Tweens>(tweens);
            }
Esempio n. 17
0
 public void Hide(bool hidden = true)
 {
     GetComponent <Canvas>().enabled = !hidden;
     if (!hidden)
     {
         StartCoroutine(Tweens.Pivot(GetComponent <RectTransform>(), new Vector2(1, 1), new Vector2(0, 1)));
     }
 }
Esempio n. 18
0
        public void Finish()
        {
            Assert.IsFalse(HighestStars < 1 || HighestStars > 3, "cannot pass with less than 1 or more than 3 stars");

            var   rt     = GetComponent <RectTransform>();
            float yPivot = rt.pivot.y;

            StartCoroutine(Tweens.Pivot(rt, new Vector2(0, yPivot), new Vector2(1, yPivot), 1, () => GetComponent <Canvas>().enabled = false));
        }
Esempio n. 19
0
        protected override bool OnUpdate(float deltaTime)
        {
            foreach (var animation in Tweens)
            {
                animation.Update(deltaTime);
            }

            return(Tweens.All(t => t.IsComplete));
        }
 public override void Run()
 {
     Cell.StartCoroutine(
         Tweens.AnimateMaterialsColorCoroutine(
             Cell.GetComponentsInChildren <Renderer>().Select(r => r.material).ToList(),
             Color.red,
             3,
             onCompleted: () => { EventActionFinished?.Invoke(this); }));
 }
Esempio n. 21
0
 public void Start()
 {
     if (Tweens.Count > 0)
     {
         CurrentAnimation = Tweens.Dequeue();
         CurrentAnimation.Play();
         CurrentAnimation.AnimationEnd += Start;
     }
 }
Esempio n. 22
0
 public void Initialize(TweenOptions o)
 {
     duration    = o.duration;
     EndEvent    = o.EndEvent;
     StartVector = o.StartVector;
     EndVector   = o.EndVector;
     curve       = o.curve;
     tweenType   = o.tweenType;
     timer       = 0;
 }
        public override void Run()
        {
            base.Run();

            _robot.StartCoroutine(
                Tweens.AnimateMaterialsColorCoroutine(
                    _robot.GetComponentsInChildren <Renderer>().Select(r => r.material).ToList(),
                    Color.red,
                    3));
        }
Esempio n. 24
0
        ///////////////////////
        // stuff for tutorials

        public void Hide(bool hidden = true)
        {
            GetComponent <Canvas>().enabled = !hidden;
            if (!hidden)
            {
                var   rt     = GetComponent <RectTransform>();
                float yPivot = rt.pivot.y;
                StartCoroutine(Tweens.Pivot(rt, new Vector2(1, yPivot), new Vector2(0, yPivot)));
            }
        }
Esempio n. 25
0
        public void ShowButtons(bool showing, float duration = .5f)
        {
            cg.interactable = showing;
            if (buttonsRoutine != null)
            {
                StopCoroutine(buttonsRoutine);
            }
            var start = showing? new Vector2(0, 0) : new Vector2(1, 0);
            var end   = showing? new Vector2(1, 0) : new Vector2(0, 0);

            StartCoroutine(buttonsRoutine = Tweens.Pivot(rt, start, end, duration));
        }
Esempio n. 26
0
    public IEnumerator ResourceAlert(Resource r, int num)
    {
        float time_start     = 0.2F;
        float time_adding    = 0.8F;
        float time_end_pause = 0.3F;
        float time_end       = 0.2F;
        float time_total     = time_start + time_adding + time_end;
        float time_curr      = 0.0F;

        UIObj   res   = ResUI.Child[(int)r.Index];
        UIAlert alert = Instantiate(UIResObj);

        alert.Init(-1, WorldObjects, time_total);
        WorldObjects.AddChild(alert);

        alert.ResetRect();
        alert.transform.position = res.Txt[0].transform.position -
                                   res.Txt[0].transform.up * 0.5F;

        Tweens.Bounce(alert.transform);

        int init = r.Current;

        alert.Txt[0].text  = "+" + num;
        alert.Svg[0].color = r.Col;

        yield return(new WaitForSeconds(time_start));

        Tweens.Bounce(res.transform);

        /*float amt_soft = num / (time_adding/Time.deltaTime);
         * while((time_curr += Time.deltaTime) <= time_adding)
         * {
         *      init += (int) amt_soft;
         *
         *      res.Txt[0].text = r.ToString();
         *
         *      yield return null;
         * }*/
        r.Add(num);
        res.Txt[0].text = r.ToString();

        yield return(new WaitForSeconds(time_end_pause));

        if (alert != null)
        {
            alert.PoolDestroy();
        }
        yield return(new WaitForSeconds(time_end));

        yield return(null);
    }
Esempio n. 27
0
            public void GetsAndSetsMove()
            {
                // Arrange
                var tweens = new Tweens();
                var move   = "none";

                // Act
                tweens.Move = move;
                var move2 = tweens.Move;

                // Assert
                Assert.Equal(move, move2);
            }
Esempio n. 28
0
            public void GetsAndSetsHit()
            {
                // Arrange
                var tweens = new Tweens();
                var hit    = "slide";

                // Act
                tweens.Hit = hit;
                var hit2 = tweens.Hit;

                // Assert
                Assert.Equal(hit, hit2);
            }
Esempio n. 29
0
            public void GetsAndSetsHitShadow()
            {
                // Arrange
                var tweens    = new Tweens();
                var hitShadow = "slide";

                // Act
                tweens.HitShadow = hitShadow;
                var hitShadow2 = tweens.HitShadow;

                // Assert
                Assert.Equal(hitShadow, hitShadow2);
            }
Esempio n. 30
0
            public void GetsAndSetsMoveShadow()
            {
                // Arrange
                var tweens     = new Tweens();
                var moveShadow = "none";

                // Act
                tweens.MoveShadow = moveShadow;
                var moveShadow2 = tweens.MoveShadow;

                // Assert
                Assert.Equal(moveShadow, moveShadow2);
            }