Exemple #1
0
 void MoveMazeToChoice()
 {
     TweenFactory.Tween("Maze", initialMazePos.position, ChoiceMazePos.position, DurationBetweenDoors, TweenScaleFunctions.SineEaseInOut, (t) => {
         // Progress
         MazeObject.transform.position = t.CurrentValue;
     });
 }
Exemple #2
0
    public void animateOffset()
    {
        foreach (GameObject gameObject in tiles)
        {
            Tile tile = gameObject.GetComponent <Tile>();
            if (tile.piece != null)
            {
                GameObject piece          = tile.piece;
                Piece      pieceComponent = piece.GetComponent <Piece>();

                if (pieceComponent.animationOffset.magnitude > 0)
                {
                    pieceComponent.offsetAnimation = TweenFactory.Tween(null, pieceComponent.animationOffset, new Vector3(0, 0, 0), 0.2f, TweenScaleFunctions.QuadraticEaseOut, t =>
                    {
                        if (piece == null)
                        {
                            return;
                        }

                        piece.transform.localPosition = t.CurrentValue;
                    });

                    pieceComponent.animationOffset = new Vector3(0, 0, 0);
                }
            }
        }
    }
    void TweenStart()
    {
        if (OneAtSameTime && !this.active)
        {
            Invoke("TweenStart", Time.fixedDeltaTime);
            return;
        }

        // Animation
        Vector3 position = ObjectToAnimate.position;

        TweenFactory.Tween("Up" + _id, position, PositionTop, GetFloat(TopAnimationTime), TweenScaleFunctions.SineEaseInOut, (t) =>
        {
            // progress
            ObjectToAnimate.position = GetPosition(t.CurrentValue);
        }, (t) =>
        {
            TweenFactory.Tween("Down" + _id, PositionTop, PositionBottom, GetFloat(TopBottomAnimationTime), TweenScaleFunctions.SineEaseInOut, (t1) =>
            {
                // progress
                ObjectToAnimate.position = GetPosition(t1.CurrentValue);
            }, (t1) =>
            {
                if (OneAtSameTime)
                {
                    TweenAnimationsManager.SetActiveNext();
                }
                Invoke("TweenStart", Time.fixedDeltaTime);
            });
        });
    }
    void DoWander()
    {
        if (GameManager.instance.selectedPerson == gameObject)
        {
            Invoke("DoWander", Random.Range(MIN_IDLE_TIME, MAX_IDLE_TIME));
            return;
        }

        Vector2 point;
        Vector3 targetPosition;
        Vector3 bounds = GetComponent <SpriteRenderer>().bounds.extents;

        do
        {
            point          = Random.insideUnitCircle * MAX_MOVE_DISTANCE;
            targetPosition = transform.position + new Vector3(point.x, point.y, 0f);
        }while (targetPosition.x < bounds.x || targetPosition.x > Screen.width - bounds.x || targetPosition.y < bounds.y || targetPosition.y > Screen.height - bounds.y);

        float distance = Vector3.Distance(transform.position, targetPosition);
        float time     = distance / MOVE_SPEED;

        moveTween = TweenFactory.Tween(null, transform.position, targetPosition, time, TweenScaleFunctions.Linear, (t) =>
        {
            transform.position = t.CurrentValue;
        }, (t) =>
        {
            moveTween = null;
            Invoke("DoWander", Random.Range(MIN_IDLE_TIME, MAX_IDLE_TIME));
        });
    }
        private void NextRound()
        {
            if (!_battle.WinnerIsDeterminated)
            {
                Unlock();

                _roundText.text = _battle.Round.ToString();

                _playerHand.SetHandShape(Hand.Rock);
                _aiPlayerHand.SetHandShape(Hand.Rock);
                _playerHand.StartShake();
                _aiPlayerHand.StartShake();
            }
            else
            {
                var rt = (RectTransform)_countdown.transform;
                _countdown.gameObject.SetActive(true);
                _countdown.text = _battle.Winner == 1 ? "YOU WIN!" : (_battle.Winner == 2 ? "YOU LOSE!" : "DEAD HEAT! O_O");
                TweenFactory.Tween(_countdown, Vector3.one * 0.3f, Vector3.one * 0.6f, 1.2f, TweenScaleFunctions.CubicEaseOut, (p) => rt.localScale = p.CurrentValue, (c) =>
                {
                    Unlock();
                    _exitButton.SetActive(true);
                });
            }
        }
Exemple #6
0
 void Start()
 {
     TweenFactory.Tween(null, new Vector3(0, 0, 0), new Vector3(1, 1, 1), 0.6f, TweenScaleFunctions.CubicEaseOut, t =>
     {
         transform.localScale = t.CurrentValue * Manager.instance.tileScale;
     });
 }
Exemple #7
0
    public void ShowView()
    {
        canvas.interactable   = true;
        canvas.blocksRaycasts = true;

        TweenFactory.Tween("FadeInCanvas", 0.0f, 1.0f, 0.5f, TweenScaleFunctions.CubicEaseOut,
                           (t) => { this.canvas.alpha = t.CurrentValue; }, (t) => { this.canvas.alpha = t.CurrentValue; });
    }
Exemple #8
0
 public void HideView()
 {
     progress_trail_fx.SetActive(false);
     logo_trail_fx.SetActive(false);
     LoadingViewFx.SetActive(false);
     TweenFactory.Tween("FadeOutCanvas", 1.0f, 0.0f, 0.5f, TweenScaleFunctions.CubicEaseOut,
                        (t) => { this.canvas.alpha = t.CurrentValue; }, (t) => { this.canvas.alpha = t.CurrentValue; });
 }
    public void HideView()
    {
        canvas.interactable   = false;
        canvas.blocksRaycasts = false;

        TweenFactory.Tween("FadeOutLanguageView", 1.0f, 0.0f, 0.5f, TweenScaleFunctions.CubicEaseOut,
                           (t) => { this.canvas.alpha = t.CurrentValue; }, (t) => { this.canvas.alpha = t.CurrentValue; });
    }
Exemple #10
0
    void FadeToWhite(float time)
    {
        FadePanel.color = new Color(1, 1, 1, 0);
        FadePanel.gameObject.SetActive(true);

        TweenFactory.Tween("ScreenFadeWhite", 0, 1, time / 2f, TweenScaleFunctions.SineEaseInOut, (t2) => {
            FadePanel.color = new Color(1, 1, 1, t2.CurrentValue);
        });
    }
Exemple #11
0
 void FadeScreen(float time)
 {
     TweenFactory.Tween("ScreenFade", 0, 1, time / 2f, TweenScaleFunctions.SineEaseInOut, (t2) => {
         FadePanel.color = new Color(0, 0, 0, t2.CurrentValue);
     }, (t2) => {
         TweenFactory.Tween("ScreenFadeALpha", 1, 0, time / 2f, TweenScaleFunctions.SineEaseInOut, (t3) => {
             FadePanel.color = new Color(0, 0, 0, t3.CurrentValue);
         });
     });
 }
 public void TweenOpacity(float to)
 {
     tempHsla = videoMaterial.GetVector("_HSLAAdjust");
     System.Action <ITween <float> > SetOpacity = (t) => {
         tempHsla   = videoMaterial.GetVector("_HSLAAdjust");
         tempHsla.w = t.CurrentValue;
         videoMaterial.SetVector("_HSLAAdjust", tempHsla);
     };
     TweenFactory.Tween(opacity, tempHsla.w, to, 1.3f, TweenScaleFunctions.CubicEaseOut, SetOpacity);
 }
Exemple #13
0
    public void explode()
    {
        tile.board.score  += (int)Mathf.Floor(pieceType.getPointsForExplode());
        tile.pieceExploded = true;
        tile.unsetPiece();
        clearAnimations();

        TweenFactory.Tween(null, new Vector3(1, 1, 1), new Vector3(0, 0, 0), 0.5f, TweenScaleFunctions.CubicEaseOut, t =>
        {
            if (this == null)
            {
                return;
            }

            Vector3 scale = t.CurrentValue;
            if (tile == null)
            {
                scale *= Manager.instance.tileScale;
            }

            scale *= board.transform.localScale.x;

            transform.localScale = scale;
        }, t =>
        {
            if (this != null)
            {
                Destroy(gameObject);
            }
        });

        Vector2 offset = Random.insideUnitCircle * 3f * board.transform.localScale.x;

        TweenFactory.Tween(null, transform.localPosition, transform.localPosition + (Vector3)offset, 0.5f, TweenScaleFunctions.QuarticEaseOut, t =>
        {
            if (this == null)
            {
                return;
            }

            transform.localPosition = t.CurrentValue;
        });

        float rotation = Random.Range(-540f, 540f);

        TweenFactory.Tween(null, new Vector3(0, 0, 0), new Vector3(0, 0, rotation), 0.5f, TweenScaleFunctions.Linear, t =>
        {
            if (this == null)
            {
                return;
            }

            transform.localEulerAngles = t.CurrentValue;
        });
    }
 // Use this for initialization
 void Start()
 {
     TweenFactory.Tween(null, 0f, 720f, 2f, TweenScaleFunctions.Linear, (t) =>
     {
         transform.localEulerAngles = new Vector3(0f, 0f, t.CurrentValue);
     }, (t) =>
     {
         Destroy(gameObject);
         onComplete(this);
     });
 }
Exemple #15
0
 private void doTween()
 {
     TweenFactory.Tween(
         null,
         transform.position,
         startPos + Random.insideUnitCircle * 4,
         Random.Range(3, 5),
         TweenScaleFunctions.SineEaseInOut,
         (ITween <Vector2> t) => transform.position = t.CurrentValue,
         (t) => doTween());
 }
    public void HideView()
    {
        BreedingViewFX.SetActive(false);
        breeding_complete_sound.Play();

        canvas.interactable   = false;
        canvas.blocksRaycasts = false;

        TweenFactory.Tween("FadeOutBreedingView", 1.0f, 0.0f, 0.5f, TweenScaleFunctions.CubicEaseOut,
                           (t) => { this.canvas.alpha = t.CurrentValue; }, (t) => { this.canvas.alpha = t.CurrentValue; });
    }
Exemple #17
0
    override public void ChangeStart()
    {
        // init anim
        startP1 = board.GetTileLocalPosition(p1.x, p1.y);
        startP2 = board.GetTileLocalPosition(p2.x, p2.y);

        startTime = Time.time;
        progress  = 0.0f;

        if (tile1)
        {
            TweenFactory.Tween(null, startP1, startP2, duration, tile1.settings.swapCurve.Evaluate,
                               (ITween <Vector3> tween) =>
            {
                if (tile1)
                {
                    tile1.transform.localPosition = tween.CurrentValue;
                }
            },
                               (ITween <Vector3> tween) =>
            {
                isComplete1 = true;
                CheckComplete();
            });
        }
        else
        {
            isComplete1 = true;
            CheckComplete();
        }
        if (tile2)
        {
            TweenFactory.Tween(null, startP2, startP1, duration, tile2.settings.swapCurve.Evaluate,
                               (ITween <Vector3> tween) =>
            {
                if (tile2)
                {
                    tile2.transform.localPosition = tween.CurrentValue;
                }
            },
                               (ITween <Vector3> tween) =>
            {
                isComplete2 = true;
                CheckComplete();
            });
        }
        else
        {
            isComplete2 = true;
            CheckComplete();
        }
    }
 void FadeInOut(float time)
 {
     TweenFactory.Tween("Color Fade In", new Color(0, 0, 0, 1), new Color(0, 0, 0, 0), time / 2, TweenScaleFunctions.CubicEaseInOut, (t) =>
     {
         BlackImage.color = t.CurrentValue;
     }, (t) =>
     {
         TweenFactory.Tween("Color Fade Out", new Color(0, 0, 0, 0), new Color(0, 0, 0, 1), time / 2, TweenScaleFunctions.CubicEaseInOut, (t2) =>
         {
             BlackImage.color = t2.CurrentValue;
         });
     });
 }
Exemple #19
0
 public void Tween()
 {
     TweenFactory.Tween("ColorDown" + _id, NormalColor, TargetColor, NormalTargetDuration, TweenScaleFunctions.SineEaseInOut, (t) =>
     {
         Sprite.color = t.CurrentValue;
     }, (t) =>
     {
         TweenFactory.Tween("ColorDown" + _id, TargetColor, NormalColor, TargetNormalDuration, TweenScaleFunctions.SineEaseInOut, (t1) =>
         {
             Sprite.color = t1.CurrentValue;
         }, (t1) => { }
                            );
     });
 }
Exemple #20
0
    // Use this for initialization
    void Start()
    {
        meteorAnim = transform.GetChild(0);
        Vector3 initialPosition = meteorAnim.position;

        TweenFactory.Tween(null, 0f, 700f, 0.8f, TweenScaleFunctions.Linear, (t) =>
        {
            meteorAnim.position = new Vector3(initialPosition.x - t.CurrentValue, initialPosition.y - t.CurrentValue, 0f);
        }, (t) =>
        {
            Destroy(gameObject);
            Instantiate(explosion, transform.position, Quaternion.identity);
        });
    }
Exemple #21
0
    public void HideView()
    {
        SpeedUpPopupViewFX.SetActive(false);
        gem_aura_fx.SetActive(false);
        hearth_spark.SetActive(false);

        if (this.canvas.alpha > 0)
        {
            canvas.interactable   = false;
            canvas.blocksRaycasts = false;

            TweenFactory.Tween("FadeOutSpeedUpView", 1.0f, 0.0f, 0.5f, TweenScaleFunctions.CubicEaseOut,
                               (t) => { this.canvas.alpha = t.CurrentValue; }, (t) => { this.canvas.alpha = t.CurrentValue; });
        }
    }
Exemple #22
0
    IEnumerator MovingCoroutine()
    {
        while (currentNode != targetNode)
        {
            yield return(new WaitForSeconds(speed));

            currentNode = nextNode;
            Vector3 position = currentNode.transform.position;
            position.y += 1;
            nextNode    = currentNode.GetRandomConnectedNode();
            TweenFactory.Tween("moving", transform.position, position, speed, TweenScaleFunctions.Linear, (t) => {
                transform.position = t.CurrentValue;
            });
        }
    }
    public void DoAttract(Vector3 targetPosition)
    {
        Vector3 bounds = GetComponent <SpriteRenderer>().bounds.extents;

        float distance = Vector3.Distance(transform.position, targetPosition);
        float time     = distance / MOVE_SPEED;

        moveTween = TweenFactory.Tween(null, transform.position, targetPosition, time, TweenScaleFunctions.Linear, (t) =>
        {
            transform.position = t.CurrentValue;
        }, (t) =>
        {
            moveTween = null;
        });
    }
Exemple #24
0
 override public void ChangeStart()
 {
     TweenFactory.Tween(null, 1.0f, 0.0f, 0.2f, TweenScaleFunctions.QuinticEaseIn,
                        (ITween <float> tween) =>
     {
         if (tile)
         {
             tile.transform.localScale = Vector3.one * tween.CurrentValue;
         }
     },
                        (ITween <float> tween) =>
     {
         isComplete = true;
     });
 }
Exemple #25
0
    public void addCombo(int comboAdd)
    {
        if (combo == 0)
        {
            comboColor = Manager.COMBO_COLORS[0];
        }
        else
        {
            float scl = 1.05f;
            if (combo + 1 >= 20)
            {
                if ((combo + 1) % 10 == 0)
                {
                    scl = 1.06f;
                }

                if ((combo + 1) % 25 == 0)
                {
                    scl = 1.07f;
                }

                if ((combo + 1) % 50 == 0)
                {
                    scl = 1.08f;
                }

                if ((combo + 1) % 100 == 0)
                {
                    scl = 1.09f;
                }

                if ((combo + 1) % 250 == 0)
                {
                    scl = 1.1f;
                }
            }

            comboAnimation = TweenFactory.Tween(null, scl, 1.0f, 0.2f, TweenScaleFunctions.QuadraticEaseIn, t =>
            {
                scaleMult = t.CurrentValue;
            });
        }

        combo    += comboAdd;
        comboTime = getComboTime(combo);
        playComboSound(combo);
    }
Exemple #26
0
    public void ShowView()
    {
        SpeedUpPopupViewFX.SetActive(true);
        gem_aura_fx.SetActive(true);
        hearth_spark.SetActive(true);

        if (this.canvas.alpha < 1f)
        {
            popup_open_sound.Play();

            canvas.interactable   = true;
            canvas.blocksRaycasts = true;

            TweenFactory.Tween("FadeInSpeedUpView", 0.0f, 1.0f, 0.5f, TweenScaleFunctions.CubicEaseOut,
                               (t) => { this.canvas.alpha = t.CurrentValue; }, (t) => { this.canvas.alpha = t.CurrentValue; });
        }
    }
Exemple #27
0
    override public void ChangeStart()
    {
        Vector3 source = tile.transform.localPosition;
        Vector3 target = board.GetTileLocalPosition(x, y);

        TweenFactory.Tween(null, source, target, 1.0f, TweenScaleFunctions.CubicEaseIn,
                           (ITween <Vector3> tween) =>
        {
            if (tile)
            {
                tile.transform.localPosition = tween.CurrentValue;
            }
        },
                           (ITween <Vector3> tween) =>
        {
            isComplete = true;
        });
    }
 private void _aiPlayer_CustomMessage(string message)
 {
     switch (message)
     {
     case "axii":
         TweenFactory.Tween(_axii, Vector3.one * 0.7f, Vector3.one * 3f, 1.2f, TweenScaleFunctions.CubicEaseOut, (p) =>
         {
             _axii.gameObject.SetActive(true);
             _axii.transform.localScale = p.CurrentValue;
             _axii.color = new Color(1f, 1f, 1f, p.CurrentProgress);
             Lock();
         }, (c) =>
         {
             _axii.gameObject.SetActive(false);
         });
         break;
     }
 }
Exemple #29
0
    void Update()
    {
        if (Input.GetButtonDown("Rotate") && !isRotating)
        {
            isRotating = true;

            TweenFactory.Tween("rotate", transform.eulerAngles.z, transform.eulerAngles.z - 90, rotateSpeed, TweenScaleFunctions.Linear, (f) => {
                Vector3 rotation      = transform.eulerAngles;
                rotation.z            = f.CurrentValue;
                transform.eulerAngles = rotation;
            }, (f) => {
                isRotating = false;
                if (updatePath != null)
                {
                    updatePath();
                }
            });
        }
    }
Exemple #30
0
    void Awake()
    {
        transform.localScale = new Vector3(0, 0, 0);
        scaleIn = TweenFactory.Tween(null, new Vector3(0, 0, 0), new Vector3(1, 1, 1), 0.3f, TweenScaleFunctions.CubicEaseOut, t =>
        {
            if (this == null)
            {
                return;
            }

            Vector3 scale = t.CurrentValue;
            if (tile == null)
            {
                scale *= Manager.instance.tileScale;
            }

            transform.localScale = scale;
        });
    }