示例#1
0
        // Called automatically by Unity when the script is first added to a gameobject or is reset from the context menu.
        void Reset()
        {
            meleeWeapon = GetComponentInChildren <MeleeWeapon>();

            Transform footStepSource = transform.Find("FootstepSource");

            if (footStepSource != null)
            {
                footstepPlayer = footStepSource.GetComponent <RandomAudioPlayer>();
            }

            Transform hurtSource = transform.Find("HurtSource");

            if (hurtSource != null)
            {
                hurtAudioPlayer = hurtSource.GetComponent <RandomAudioPlayer>();
            }

            Transform landingSource = transform.Find("LandingSource");

            if (landingSource != null)
            {
                landingPlayer = landingSource.GetComponent <RandomAudioPlayer>();
            }
        }