Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, Vector3.down, out hit))
        {
            string floorTag = hit.collider.gameObject.tag;

            // Wood
            if (floorTag == "WoodFloor" && floorTag != previousFloor)
            {
                previousFloor = floorTag;
                m_FirstPersonController.ChangeFootstepAudio(m_WoodSteps);
            }

            // Concrete
            else if (floorTag == "ConcreteFloor" && floorTag != previousFloor)
            {
                previousFloor = floorTag;
                m_FirstPersonController.ChangeFootstepAudio(m_ConcreteSteps);
            }

            else if (floorTag == "CarpetFloor" && floorTag != previousFloor)
            {
                previousFloor = floorTag;
                m_FirstPersonController.ChangeFootstepAudio(m_CarpetSteps);
            }

            // Grass
            else if (floorTag == "Untagged" && floorTag != previousFloor)
            {
                previousFloor = floorTag;
                m_FirstPersonController.ChangeFootstepAudio(m_GrassSteps);
            }
        }
    }