clearEvents() public method

clears out all the TweenProperties
public clearEvents ( ) : GoTweenConfig,
return GoTweenConfig,
Esempio n. 1
0
 static public int clearEvents(IntPtr l)
 {
     try {
         GoTweenConfig self = (GoTweenConfig)checkSelf(l);
         var           ret  = self.clearEvents();
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 2
0
    void Unbop()
    {
        if (canControl) return;

        StartCoroutine(InvincibilityTimeout());

        canControl = true;

        // Tween cleanup, remove stun halo
        Go.killAllTweensWithTarget(stunHalo);
        haloUndoConfig.clearEvents();
        haloUndoConfig.onComplete(c => {
            stunHalo.gameObject.SetActive(false);
        });
        Go.to(stunHalo, 0.5f, haloUndoConfig);

        if (tired) {
            face.SetFace(Face.FaceType.Tired);
        } else {
            // return to default face if we're not in 'surprised' mode
            if (face.ActiveFace != Face.FaceType.Surprised) {
                var reaction = Random.Range(0f, 1f) < 0.5f ?
                    Face.FaceType.Default :
                    Face.FaceType.Frowning;

                face.SetFace(reaction);
            }
        }

        isInked = false;
        head.DisableInkSplat();

        bopTweenConfig.clearEvents();
        bopTweenConfig.clearProperties();
        bopTweenConfig.setEaseType(GoEaseType.ElasticOut);

        if (elasticRoutine != null) StopCoroutine(elasticRoutine);
        elasticRoutine = StartCoroutine(ElasticStandUp());

        // Jump up from bopped position
        if (surface == Surface.Ground) {
            cachedVelocity = rbody.velocity;
            cachedVelocity.y = jumpSpeed / 1.5f;
            rbody.velocity = cachedVelocity;
        }
    }
    public void AnimatePositioningItem(Transform parentTo, System.Action <ItemPickup> endAnimationEvent, AudioType playSound = AudioType.None)
    {
        // Setup variables
        onAnimationEnd   = endAnimationEvent;
        transform.parent = parentTo;

        // Setup animation configuration
        itemAnimationConfiguration.clearEvents();
        itemAnimationConfiguration.clearProperties();

        // Setup scale and rotation
        itemAnimationConfiguration.localRotation(Quaternion.identity);
        itemAnimationConfiguration.scale(Vector3.one);

        // Setup path
        itemTweenPath[0] = transform.localPosition;
        itemTweenPath[1] = new Vector3((transform.localPosition.x / 2f), midTweenOffset, 0);
        itemAnimationConfiguration.localPositionPath(new GoSpline(itemTweenPath));

        // Check if we need to clean up the animation
        if (itemAnimation != null)
        {
            // Clean up this item animation from the animation queue
            Go.removeTween(itemAnimation);
            itemAnimation = null;
        }

        // Create and play a new animation
        itemAnimation = Go.to(transform, animationDuration, itemAnimationConfiguration);
        itemAnimation.setOnCompleteHandler(OnAnimationEnds);
        itemAnimation.play();

        // Play a sound effect
        if (playSound == AudioType.Place)
        {
            PlayClip(dropSound);
        }
        else if (playSound == AudioType.PickUp)
        {
            PlayClip(pickupSound);
        }
    }
Esempio n. 4
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);
    }