예제 #1
0
        /// <summary>
        /// initializes all parameters prior to a dash and triggers the pre dash feedbacks
        /// </summary>
        public virtual void InitiateGrapple()
        {
            // we start our sounds
            PlayAbilityStartSfx();
            PlayAbilityUsedSfx();

            // we initialize our various counters and checks
            CooldownTimeStamp = Time.time + grappleCooldown;

            ComputeGrappleDirection();
            CheckFlipCharacter();

            RaycastHit2D hit = MMDebug.RayCast(transform.position, GrappleDirection, grappleDistance, _controller.PlatformMask, Color.blue, true);

            if (hit.collider == null)
            {
                return;
            }

            GameObject    go   = Instantiate(grapplePrefab, hit.point, new Quaternion(), hit.transform.parent);
            GrapplingHook hook = go.GetComponent <GrapplingHook>();

            hook.hasGrip = hasGrip;
            hook.source  = gameObject;
            hook.DeployHook();

            // we play our exit sound
            StopAbilityUsedSfx();
            PlayAbilityStopSfx();
        }