コード例 #1
0
        private void Start()
        {
            if (!usedByNPC)
            {
                audioSource  = GetComponent <AudioSource>();
                collisionTag = GetComponentInParent <GetCollisionTag>();
            }

            if (usedByNPC)
            {
                agent        = GetComponentInParent <NavMeshAgent>();
                collisionTag = GetComponent <GetCollisionTag>();
            }
        }
コード例 #2
0
        public void PlayFootstep()
        {
            switch (collisionTag.contactTag)
            {
            case "Dirt":
                AkSoundEngine.PostEvent(footstepsSFX, gameObject);
                break;

            case "Wood":
                AkSoundEngine.SetSwitch("footsteps", "wood", gameObject);
                AkSoundEngine.PostEvent(footstepsSFX, gameObject);
                collisionTagBuffer = collisionTag;
                break;

            case "Concrete":
                AkSoundEngine.SetSwitch("footsteps", "concrete", gameObject);
                AkSoundEngine.PostEvent(footstepsSFX, gameObject);
                collisionTagBuffer = collisionTag;
                break;

            case "Metal":
                AkSoundEngine.SetSwitch("footsteps", "metal", gameObject);
                AkSoundEngine.PostEvent(footstepsSFX, gameObject);
                collisionTagBuffer = collisionTag;
                break;

            case "Water":
                AkSoundEngine.SetSwitch("footsteps", "water", gameObject);
                AkSoundEngine.PostEvent(footstepsSFX, gameObject);
                collisionTagBuffer = collisionTag;
                break;

            case "Sand":
                AkSoundEngine.SetSwitch("footsteps", "sand", gameObject);
                AkSoundEngine.PostEvent(footstepsSFX, gameObject);
                collisionTagBuffer = collisionTag;
                break;

            default:
                AkSoundEngine.SetSwitch("footsteps", collisionTagBuffer.contactTag, gameObject);
                AkSoundEngine.PostEvent(footstepsSFX, gameObject);
                break;
            }
        }
コード例 #3
0
 private void Start()
 {
     collisionTag = GameObject.Find("Player").GetComponent <GetCollisionTag>();
 }