destroy() public method

removes the tween and cleans up its state
public destroy ( ) : void
return void
示例#1
0
    public void Grow()
    {
        if (tween != null)
        {
            tween.destroy();
        }

        var scaleProperty = new ScaleTweenProperty(new Vector3(maxSize, maxSize, maxSize));
        var config        = new GoTweenConfig();

        config.addTweenProperty(scaleProperty);

        tween = new GoTween(transform, growingSpeed, config);
        tween.setOnCompleteHandler(c => {
            StartExplosionEffect();
            Invoke("Explode", timeToExplode);
        });

        Go.addTween(tween);

        Go.to(transform, 5f, new GoTweenConfig()
              .eulerAngles(new Vector3(0, 0, 360))
              .setEaseType(GoEaseType.Linear)
              .setIterations(-1, GoLoopType.RestartFromBeginning)
              );
    }
示例#2
0
 void OnDestroy()
 {
     if (backgroundAnimation != null)
     {
         backgroundAnimation.destroy();
     }
 }
示例#3
0
 public void Show()
 {
     if (fadeAnimation != null)
     {
         fadeAnimation.destroy();
     }
     gameObject.SetActive(true);
     fadeAnimation = Go.to(sprite, .4f, new GoTweenConfig().colorProp("color", Color.white));
 }
示例#4
0
    public void Narrower()
    {
        if (zoomTween != null)
        {
            zoomTween.destroy();
        }

        zoomTween = Go.to(this, kFovChangeDuration, new GoTweenConfig().floatProp("zoom", 1).onComplete(t => OnNarrowed()));
    }
示例#5
0
    public void ConstantSpeedTo(float targetOpacity, float fadeSpeed)
    {
        this.targetOpacity = targetOpacity;
        this.fadeSpeed     = fadeSpeed;
        state = State.ConstantSpeed;

        if (fadeTween != null)
        {
            fadeTween.destroy();
            fadeTween = null;
        }
    }
示例#6
0
文件: Scroll.cs 项目: SavaMinic/ld36
    void OnMouseEnter()
    {
        if (!StarManager.Instance.IsPlaying)
        {
            return;
        }

        if (moveAnimation != null)
        {
            moveAnimation.complete();
            moveAnimation.destroy();
        }
        moveAnimation = Go.to(transform, .4f, new GoTweenConfig().position(endPosition).setEaseType(GoEaseType.BackInOut));
    }
示例#7
0
 public void StartTalk(List <string> talks, bool isIntro = false, bool generateStars = false)
 {
     FindObjectOfType <InputController>().HideButtons();
     this.talks         = talks;
     this.isIntro       = isIntro;
     this.generateStars = generateStars;
     background.Show();
     if (kingAnimation != null)
     {
         kingAnimation.destroy();
     }
     kingAnimation = Go.to(king.transform, 1.2f, new GoTweenConfig().position(talkPosition).setEaseType(GoEaseType.BackInOut));
     NextTalk();
 }
示例#8
0
    public void HideGUI()
    {
        if (notificationStatus != NotificationStatus.Nothing)
        {
            if (notificationTween != null)
            {
                notificationTween.destroy();
                notificationTween = null;
            }
            notificationText.text = "";
            notificationStatus    = NotificationStatus.Nothing;
        }

        notificationText.gameObject.SetActive(false);
    }
示例#9
0
 void OnDestroy()
 {
     if (movingAnimation != null)
     {
         movingAnimation.destroy();
     }
     if (colorAnimation != null)
     {
         colorAnimation.destroy();
     }
     if (zoomAnimation != null)
     {
         zoomAnimation.destroy();
     }
 }
示例#10
0
    private void OnMilestoneChanged()
    {
        var milestoneProgress = GameController.I.MilestoneProgress(GameController.I.Score);

        if (milestoneChangeTween != null && milestoneChangeTween.state == GoTweenState.Running)
        {
            milestoneChangeTween.destroy();
        }
        milestoneChangeTween = Go.to(milestoneScoreSlider, scoreChangeDuration,
                                     new GoTweenConfig().floatProp("value", milestoneProgress)
                                     .setEaseType(scoreChangeEaseType)
                                     .setDelay(scoreChangeDelay)
                                     );

        milestoneRewardText.text = GameController.I.MilestoneReward.ToString();
        milestoneScoreText.text  = "SCORE " + GameController.I.MilestonePoint + " FOR REWARD";
    }
示例#11
0
    public void End(float duration, GoEaseType easeType = GoEaseType.Linear)
    {
        if (_beginTween.state == GoTweenState.Running)
        {
            _beginTween.pause();
            _beginTween.destroy();
        }

        Go.to(_stars, duration, new GoTweenConfig().floatProp("startSpeed", 100f).setEaseType(easeType).onComplete(t => Stop()));
    }
示例#12
0
    public void End(float duration, GoEaseType easeType = GoEaseType.Linear)
    {
        if (_beginTween.state == GoTweenState.Running)
        {
            _beginTween.pause();
            _beginTween.destroy();
        }

        Go.to(_radialBlur, duration, new GoTweenConfig().floatProp("BlurStrength", 0f).setEaseType(easeType));
    }
示例#13
0
    /// <summary>
    /// kills all tweens with the given target by calling the destroy method on each one
    /// </summary>
    public void killAllTweensWithTarget(object target)
    {
        List <GoTween> items = tweensWithTarget(target, true);

        for (int k = 0; k < items.Count; ++k)
        {
            GoTween tween = items[k];
            tween.destroy();
        }
    }
示例#14
0
    public static void killAllTweensWithTarget(object target)
    {
        List <GoTween> list = tweensWithTarget(target, traverseCollections: true);

        for (int i = 0; i < list.Count; i++)
        {
            GoTween goTween = list[i];
            goTween.destroy();
        }
    }
示例#15
0
    public void End(float duration, GoEaseType easeType = GoEaseType.Linear)
    {
        if (_beginTween.state == GoTweenState.Running)
        {
            _beginTween.pause();
            _beginTween.destroy();
        }

        Go.to(_camera, duration, new GoTweenConfig().floatProp("fieldOfView", _originalValue).setEaseType(easeType));
    }
示例#16
0
 public void Die()
 {
     walkingAroundTween.pause();
     walkingAroundTween.destroy();
     markedForDestruction = true;
     Go.to(gameObject.transform, .3f, new GoTweenConfig().scale(0f).onComplete(goTween =>
     {
         Destroy(gameObject);
     }));
 }
示例#17
0
 static public int destroy(IntPtr l)
 {
     try {
         GoTween self = (GoTween)checkSelf(l);
         self.destroy();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
示例#18
0
    private void OnScoreChanged(int newScore)
    {
        if (GameController.I.GameMode == GameController.GameModeType.Endless)
        {
            if (newScore > PlayerData.HighScore)
            {
                PlayerData.SetHighscore(newScore);
                HeaderController.I.UpdateHighScore(newScore);
            }

            var milestoneProgress = GameController.I.MilestoneProgress(newScore);
            if (milestoneChangeTween != null && milestoneChangeTween.state == GoTweenState.Running)
            {
                milestoneChangeTween.destroy();
            }
            milestoneChangeTween = Go.to(milestoneScoreSlider, scoreChangeDuration,
                                         new GoTweenConfig().floatProp("value", milestoneProgress)
                                         .setEaseType(scoreChangeEaseType)
                                         .setDelay(scoreChangeDelay)
                                         );
            milestoneChangeTween.setOnCompleteHandler(t =>
            {
                if (newScore >= GameController.I.MilestonePoint)
                {
                    GameController.I.NextMilestone();
                }
            });
        }

        if (!GameController.I.HasTargetScore)
        {
            return;
        }

        var progress = (float)newScore / GameController.I.TargetScore;

        if (GameController.I.IsPlaying)
        {
            if (scoreChangeTween != null && scoreChangeTween.state == GoTweenState.Running)
            {
                scoreChangeTween.destroy();
            }
            scoreChangeTween = Go.to(targetScoreSlider, scoreChangeDuration,
                                     new GoTweenConfig().floatProp("value", progress)
                                     .setEaseType(scoreChangeEaseType)
                                     .setDelay(scoreChangeDelay)
                                     );
        }
        else
        {
            // instant change
            targetScoreSlider.value = progress;
        }
    }
示例#19
0
    public void FadeIn(float duration = 2, Action <CameraFader> onComplete = null)
    {
        if (fadeTween != null)
        {
            fadeTween.destroy();
        }

        isFading  = true;
        alpha     = 1;
        fadeTween = Go.to(this, duration, new GoTweenConfig()
                          .floatProp("alpha", 0)
                          .setEaseType(GoEaseType.SineOut)
                          .onComplete(t => {
            isFading  = false;
            fadeTween = null;
            if (onComplete != null)
            {
                onComplete(this);
            }
        }));
    }
示例#20
0
    new void OnDestroy()
    {
        base.OnDestroy();

        if (tween != null)
        {
            tween.destroy();
        }

        if (spriteTween != null)
        {
            spriteTween.destroy();
        }
    }
示例#21
0
 public void Open()
 {
     if (toggleAnimation != null)
     {
         toggleAnimation.complete();
         toggleAnimation.destroy();
     }
     if (myRenderer.enabled)
     {
         AnimateClose(AnimateOpening);
     }
     else
     {
         AnimateOpening();
     }
 }
示例#22
0
    private void ShowRankingsTab(int index)
    {
        currentlyShownRankingTab = index;
        for (int i = 0; i < rankingsButtons.Count; i++)
        {
            rankingsButtons[i].GetComponent <Image>().color = index == i ? rankingButtonActiveColor : rankingButtonDefaultColor;
        }

        loadingRankingsText.gameObject.SetActive(true);
        if (rankingsShowTween != null && rankingsShowTween.state == GoTweenState.Running)
        {
            rankingsShowTween.destroy();
        }
        rankingContentCanvasGroup.alpha = 0f;
        RankingsData.GetRankings(index, ShowRankingContent);
    }
示例#23
0
    public void PlayerAttacks()
    {
        float sliderX = slider.position.x;

        sliderTween.destroy();
        sliderTween = null;
        if (sliderX > (successBeginXform.position.x - leeway) && sliderX < (successEndXform.position.x + leeway))
        {
            playerWonLastRound = true;
            Audio.Instance.PlayKnifeHit();
        }
        else
        {
            playerWonLastRound = false;
            Audio.Instance.PlayKnifeMiss();
        }
    }
示例#24
0
    private void Kick()
    {
        justKicked = true;

        bool kickedButton = false;

        kickOffset = new Vector2(direction, Random.Range(0.1f, 0.3f));

        Player otherPlayer = null;
        int numKicks = Physics2D.OverlapCircleNonAlloc(_transform.position, kickRadius, kickScan, kickMask);

        //Collider2D[] kickScan = Physics2D.OverlapCircleAll(_transform.position, kickRadius, kickMask);
        if (UIManager.current_scene_name == GlobalStrings.SCENE_Select || GameManager.FOUND_SECRET) {
            // Code to prioritise buttons
            for (int i = 0; i < numKicks; i++) {
                Collider2D collider = kickScan[i];

                // TODO replace getcomponent by actually naming spawned prefabs by their username
                if ((collider.CompareTag(GlobalStrings.TAG_CustomiserButton) || collider.CompareTag("SECRET")) && (collider.transform.localPosition.y <= transform.localPosition.y)) {
                    collider.GetComponent<KickButton>().KickAction(this);
                    kickedButton = true;

                    // Adjust offset
                    float jitter = 0.1f;
                    Vector2 diff = (Vector2)(collider.transform.position - _transform.position);
                    kickOffset = diff + new Vector2(-0.8f * Mathf.Sign(diff.x) + Random.Range(-jitter, jitter), 0.45f);

                    break;
                }
            }
        }

        if (!kickedButton) otherPlayer = ScanKickable(kickScan, numKicks);

        bool kickSuccess = false;

        if (otherPlayer != null) {
            Vector2 posSub = otherPlayer.transform.position - _transform.position;
            if (!kickedButton) kickOffset = new Vector2(Mathf.Sign (posSub.x) * 2, Random.Range(0.35f, 0.7f));

            otherPlayer.Bop(kickOffset, BopType.KICKED, this);

            if (otherPlayer.Dashing) {
                achievementMgr.GetAxed();
            }

            // Update sorting - bring slamming pode in front
            int i0 = sortingOrder;
            int i1 = otherPlayer.sortingOrder;
            if (i0 < i1) {
                SetOrder(i1);
                otherPlayer.SetOrder(i0);
            }

            // SCREENSHAKE YESSSSSSSSSSSSSSSSSSSSSSSSSSS
            cam.ShakeScreen(posSub.normalized * Random.Range(4f, 6f), 0.5f);

            Squish(SquishType.KICK);
            kickSuccess = true;

            _audio.PlayClipOnce("kick_contact", 6f * AudioManager.sfxVol, Random.Range(0.8f, 1.3f));
        } else {
            // Missed the kick, minor visual update
            Squish(SquishType.KICKMISS);

            _audio.PlayClipOnce("kick_nocontact", 6f * AudioManager.sfxVol, Random.Range(0.8f, 1.3f));
        }

        float retractTime = (kickSuccess) ? kickHitRetractTime : kickRetractTime;
        kickTentacleIndex = (Mathf.Sign(kickOffset.x) < 0) ? 0 : 2; // send out nearest tentacle
        Leg kicker = legs[kickTentacleIndex];
        kicker.kicking = true;

        // Leg tween
        kickRetractConfig.clearEvents();
        kickRetractConfig.setDelay(kickExtendTime);

        if (kickRetractTween != null) kickRetractTween.destroy();
        kickRetractTween = Go.to(this, retractTime, kickRetractConfig);

        // Set leg thickness over total kick time
        kicker.StartKicking(kickExtendTime + retractTime);
    }
示例#25
0
 public void StopTween()
 {
     currentTween.destroy();
 }