コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        _timer += Time.deltaTime;
        if (PlayStepSounds && (_timer > stepDelay) && (_playerRB.velocity.x * _playerRB.velocity.x) > 0)
        {
            int caseValue = Random.Range(0, 5);
            switch (caseValue)
            {
            case 1:
                Step1.Play();
                break;

            case 2:
                Step2.Play();
                break;

            case 3:
                Step3.Play();
                break;

            case 4:
                Step4.Play();
                break;
            }
            _timer = 0;
        }
    }