コード例 #1
0
    private void StopFollowing()
    {
        if (!alreadyFinished)
        {
            isMoving = false;
            isUsed   = true;
            if (OnlyUsedOnce)
            {
                gameObject.SetActive(false);
            }
            if (generated.transform.parent != null)
            {
                generated.transform.parent = null;
            }
            movementController.IsFuseMoving = false;
            alreadyFinished = true;
            AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.OffRope, audioEvents, gameObject);
            _flameAttachToggler.FlameOff();

            movementController.IsInvulnerable = false;
            if (playerRigidbody != null)
            {
                playerRigidbody.velocity = Vector3.zero;
            }
            movementController.StopMoving(InteractibleObject.InteractType.Fuse);
        }
    }
コード例 #2
0
    public void Detach()
    {
        Transform parent = gameObject.transform.parent;

        if (parent != null)
        {
            AudioEvent.SendAudioEvent(AudioEvent.AudioEventType.OffPlane, audioEvents, gameObject);

            // Update Animator
            GetComponent <MovementController>().StopMoving(InteractibleObject.InteractType.Projectile);

            //water temp fix
            Collider[] colls = Physics.OverlapSphere(transform.position, 0.3f);

            foreach (Collider coll in colls)
            {
                if (
                    coll.gameObject != transform.parent &&
                    coll.gameObject.GetComponent <InteractibleObject>() != null
                    )
                {
                    //Debug.Log(coll.gameObject.name + "was here");
                    coll.gameObject.GetComponent <InteractibleObject>().Interact(coll.transform.position);
                }
            }

            parent.GetComponent <PaperPlane>().playerAttachedToThis = false;
            transform.parent = null;
            rb.velocity      = Vector3.zero;
            rb.useGravity    = true;
            _attached        = false;

            GetComponent <MovementController>().IsInvulnerable = false;

            _flameAttachToggler.FlameOff();
        }
    }