Ejemplo n.º 1
0
        public void PlayRandomClip(FootStepObject footStepObject)
        {
            if (audioClips == null || audioClips.Count == 0)
            {
                return;
            }

            if (randomSource == null)
            {
                randomSource = new FisherYatesRandom();
            }

            soundPool.Invoke(audioSource.gameObject, footStepObject, audioMixerGroup, audioClips);
        }
Ejemplo n.º 2
0
 public void PlayFootFallSound(FootStepObject footStepObject)
 {
     for (int i = 0; i < customSurfaces.Count; i++)
     {
         if (customSurfaces[i] != null && ContainsTexture(footStepObject.name, customSurfaces[i]))
         {
             customSurfaces[i].PlayRandomClip(footStepObject);
             return;
         }
     }
     if (defaultSurface != null)
     {
         defaultSurface.PlayRandomClip(footStepObject);
     }
 }
Ejemplo n.º 3
0
 public void StepOnMesh(FootStepObject footStepObject)
 {
     if (currentStep != null && currentStep == footStepObject.sender)
     {
         return;
     }
     currentStep = footStepObject.sender;
     if (stepSmokePaticle)
     {
         var particle = Instantiate(stepSmokePaticle, footStepObject.sender.position, footStepObject.sender.rotation) as GameObject;
         Destroy(particle, 0.5f);
     }
     stepMarkPool.Invoke(stepMarkPaticle, footStepObject, stepLayer);
     PlayFootFallSound(footStepObject);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 발자국
        /// </summary>
        /// <param name="footStep"></param>
        void StepMark(FootStepObject footStep)
        {
            RaycastHit hit;

            if (Physics.Raycast(transform.position + new Vector3(0, 0.1f, 0), -footStep.sender.up, out hit, 1f, stepLayer))
            {
                var angle = Quaternion.FromToRotation(footStep.sender.up, hit.normal);
                if (stepMark != null)
                {
                    objectPool.Register(stepMark, stepMark.transform.parent);
                    var step = objectPool.GetInstance();
                    step.transform.position = hit.point;
                    step.transform.rotation = angle * footStep.sender.rotation;
                    StartCoroutine(objectPool.UnUseInsert(step, activeTime));
                }
            }
        }
Ejemplo n.º 5
0
        public void StepOnTerrain(FootStepObject footStepObject)
        {
            if (currentStep != null && currentStep == footStepObject.sender)
            {
                return;
            }
            currentStep = footStepObject.sender;

            if (terrainData)
            {
                surfaceIndex = GetMainTexture(footStepObject.sender.position);
            }

            var name = (terrainData != null && terrainData.splatPrototypes.Length > 0) ? (terrainData.splatPrototypes[surfaceIndex]).texture.name : "";

            footStepObject.name = name;
            PlayFootFallSound(footStepObject);

            if (debugTextureName)
            {
                Debug.Log(name);
            }
        }