setDelay() public method

sets the delay for the tween
public setDelay ( float seconds ) : GoTweenConfig
seconds float
return GoTweenConfig
Esempio n. 1
0
 static public int setDelay(IntPtr l)
 {
     try {
         GoTweenConfig self = (GoTweenConfig)checkSelf(l);
         System.Single a1;
         checkType(l, 2, out a1);
         var ret = self.setDelay(a1);
         pushValue(l, ret);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Esempio n. 2
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);
    }