Ejemplo n.º 1
0
 public static GOTween GOLocalMove(this Transform transform, Vector3 endValue, float duration)
 {
     return(GOTween.To(
                () => transform.localPosition,
                value => transform.localPosition = value,
                endValue,
                duration
                ));
 }
Ejemplo n.º 2
0
    void Start()
    {
        sequence = GOTween.Sequence().SetEase(GOEase.SmoothStep);
        sequence.Insert(1, transform.GOLocalMove(
                            new Vector3(0, 5, 0),
                            1f
                            ));

        StartCoroutine(StartAddingPosition());
    }
Ejemplo n.º 3
0
    public void Insert(float atTime, GOTween gTween)
    {
        var id = GetID();

        items.Add(id, new SequenceItem {
            id       = id,
            atTime   = atTime,
            duration = gTween.Duration,
            watcher  = gTween
        });
    }
Ejemplo n.º 4
0
    public void KillMe()
    {
        if (!m_taken)
        {
            m_taken = false;

            GOTween tween = new GOTween(this.gameObject, 1.0f, EaseFunctions.Sine.EaseIn, (x) => Destroy(x)).ScaleTo(new Vector3(15.0f, 15.0f, 1.0f)).SpriteFade(0.2f);
            GOTween otherTween = new GOTween(this.gameObject, 0.8f, EaseFunctions.QuartInOut).MoveLocalTo(2 * Vector2.up);
            TweenController.Launch(tween);
            TweenController.Launch(otherTween);
            m_taken = true;
            tween = null;
            otherTween = null;
        }
    }
Ejemplo n.º 5
0
    IEnumerator StartUpdateChanges(Action <Int64> OnNoAnyMatches)
    {
        isPlaying = true;

        sequence = GOTween.Sequence().SetAutoKill(false);

        var currentFrame  = 0;
        var startTurn     = Model.currentTurn;
        var noUpdateCount = 0;

        while (true)
        {
            if (currentFrame % FRAME_BY_TURN == 0)
            {
                var passedTurn  = Model.currentTurn - startTurn;
                var currentTime = FRAME_BY_TURN * TIME_PER_FRAME * passedTurn;
                // Debug.Log("currentTime : " + Model.currentTurn + ", " + currentTime);
                var countOfAction = actionQueueByTurn.Count;

                Queue <Action <GOSequence, float> > actionQueue;
                if (actionQueueByTurn.TryGetValue(Model.currentTurn, out actionQueue))
                {
                    while (actionQueue.Count > 0)
                    {
                        var action = actionQueue.Dequeue();
                        action.Invoke(sequence, currentTime);
                    }
                    actionQueueByTurn.Remove(Model.currentTurn);
                }

                updateResult.feedResult  = Controller.Feed();
                updateResult.fallResult  = Controller.Fall();
                updateResult.matchResult = Controller.Match();

                if (passedTurn == 6)
                {
                    if (updateResult.matchResult.Count == 0 && OnNoAnyMatches != null)
                    {
                        OnNoAnyMatches(passedTurn);
                    }
                }

                if (updateResult.HasAnyResult)
                {
                    noUpdateCount = 0;

                    MatchGems(updateResult.matchResult, sequence, currentTime);
                    FeedGems(updateResult.feedResult, sequence, currentFrame);
                    FallGems(updateResult.fallResult, sequence, currentTime);
                }
                else if (countOfAction > 0)
                {
                    noUpdateCount = 0;
                }
                else
                {
                    noUpdateCount += 1;
                }

                Controller.TurnNext();

                // Debug.Log(noUpdateCount + ", " + sequence.IsComplete + ", " + countOfAction);
                if (passedTurn > 20)
                {
                    yield return(null);
                }
                if (noUpdateCount > 20 && sequence.IsComplete)
                {
                    break;
                }
            }

            currentFrame += 1;
        }

        sequence.Kill();
        isPlaying = false;
    }