예제 #1
0
    public static void playDieSound(string id, Character.ID playerType = Character.ID.LEO)
    {
                #if UNITY_EDITOR
        if (BattleSimulator.nowSimulation && BattleSimulator.instance.skipTime > 1)
        {
            return;
        }
                #endif

        if (GameManager.info.soundData.TryGetValue(id, out _sd) == false)
        {
            return;
        }

        if (string.IsNullOrEmpty(_sd.link) == false)
        {
            playDieSound(_sd.link);
            return;
        }

        if (_sd.type == Type.Chracter)
        {
            play(_sd.getCharacterDieSound());
        }
        else if (_sd.type == Type.Player)
        {
            string[] temp = null;

            switch (playerType)
            {
            case Character.ID.LEO:
                temp = Character.LEO_DIE;
                break;

            case Character.ID.KILEY:
                temp = Character.KILEY_DIE;
                break;

            case Character.ID.CHLOE:
                temp = Character.CHLOE_DIE;
                break;
            }

            if (temp != null)
            {
                if (_sd.dieNum > 1)
                {
                    int dieNum = UnityEngine.Random.Range(0, _sd.dieNum);

                    playDieVoice(temp[dieNum]);
                }
                else
                {
                    playDieVoice(temp[0]);
                }
            }
        }
    }