示例#1
0
    protected void    PlayDieAudio(sdGameActor actor)
    {
        string[]    strAudioArray = { "$warrior_sound/m_2_die_01.wav", "$mage_sound/w_2_die_02.wav", "$ranger_sound/m_4_die_02.wav", "$cleric_sound/woman_die_01.wav" };
        sdGameActor mainchar      = sdGameLevel.instance.mainChar;

        if (actor.GetInstanceID() == mainchar.GetInstanceID() && this == mainchar.logicTSM.die)
        {
            int job = (int)mainchar.GetJob();
            job = job / 3;
            if (job >= 0 && job < strAudioArray.Length)
            {
                actor.PlayAudio(strAudioArray[job]);
            }
        }
    }
示例#2
0
    public void playAudio(sdGameActor _gameActor)
    {
        if (_gameActor == null)
        {
            return;
        }
        if (aniState == null)
        {
            return;
        }
        if (stateData == null)
        {
            if (_gameActor.GetInstanceID() == sdGameLevel.instance.mainChar.GetInstanceID() && this == _gameActor.logicTSM.run)
            {
                playRunAudio(_gameActor);
            }
            return;
        }

        AudioSource audio = _gameActor.SelfAudioSource;

        string[] strAudio = (string[])stateData["AudioConf"];
        if (strAudio != null && strAudio.Length != 0)
        {
            int[] startTime = (int[])stateData["AudioStartTime"];

            for (int index = 0; index < startTime.Length && index < strAudio.Length; ++index)
            {
                float testPoint = (float)startTime[index] * 0.0001f;
                if (aniState.wrapMode == WrapMode.Loop)
                {
                    testPoint = testPoint + ((int)aniState.normalizedTime);
                }

                if (audio != null && testPoint >= _gameActor.PreviousAudioTime && testPoint <= aniState.normalizedTime)
                {
                    _gameActor.PlayAudio(strAudio[index]);
                }
            }
            _gameActor.PreviousAudioTime = aniState.normalizedTime;
        }
    }