Beispiel #1
0
    public override void doDie(Creature killer)
    {
        SwarmController.getInstance().notifyTargetDestroyed();

        Vector3 originalPos = _gameInstance.transform.position;

        GameObject.Destroy(_gameInstance);

        GameObject fractured = GameObject.Instantiate(
            Resources.Load("Models/Target_Castle/Fractured/target_castle_fractured"),
            World.getInstance().getTerrainTransform()) as GameObject;

        fractured.transform.position = originalPos;

        fractured.AddComponent <TowerCollapse> ().setFlags(true, true);

        GameObject ps = ParticleSystemTable.getInstance().instantiateParticleSystem("PS_Collapse");

        ps.transform.position = originalPos;
        ps.AddComponent <ParticleSystemCollector> ();
        ps.GetComponent <ParticleSystem> ().Play();
        ps.AddComponent <AudioSource> ().loop = false;
        SoundTable.getInstance().getAudioPlayer(ps.GetComponent <AudioSource> (), "sound_collapse");
        ps.GetComponent <AudioSource> ().Play();

        CameraShake.INSTANCE.prepareShake();

        LevelManager.getInstance().notifyTargetDestroyed();
    }
    public override void doDie(Creature killer)
    {
        World.getInstance().unregisterTower(this);
        World.getInstance().unregisterTowerBySpawn(_spawn);

        _gameInstance.GetComponent <HealthBarController> ().destroy();

        Vector3 originalPos = getGameInstance().transform.position;

        GameObject.Destroy(getGameInstance());

        GameObject fracturedInstance = GameObject.Instantiate(
            getTower().getFracturedAsset(), World.getInstance().getTerrainTransform()) as GameObject;

        fracturedInstance.transform.position = originalPos;
        fracturedInstance.AddComponent <TowerCollapse> ().Propagate = true;

        GameObject ps = ParticleSystemTable.getInstance().instantiateParticleSystem("PS_Collapse");

        ps.transform.position = originalPos;
        ps.AddComponent <ParticleSystemCollector> ();
        ps.GetComponent <ParticleSystem> ().Play();
        ps.AddComponent <AudioSource> ().loop = false;
        SoundTable.getInstance().getAudioPlayer(ps.GetComponent <AudioSource> (), "sound_collapse");
        ps.GetComponent <AudioSource> ().Play();
        CameraShake.INSTANCE.prepareShake();

        PlatfromSpawnTable.getInstance().enablePlatform(_spawn);
        SpawnTable.getInstance().releaseSpawn(_spawn);
    }
Beispiel #3
0
 public SoundData(SoundData p_data)
 {
     table         = p_data.table;
     key           = p_data.key;
     clip          = p_data.clip;
     defaultVolume = p_data.defaultVolume;
     defaultLoop   = p_data.defaultLoop;
 }
Beispiel #4
0
 public LocalDB(string dbPath) : base(dbPath)
 {
     SetTables(
         (Sounds = new SoundTable(this)),
         (GameDataUrls = new GameDataUrlTable(this)),
         (Games = new GameTable(this)),
         (Teams = new TeamTable(this)),
         (Players = new PlayerTable(this)));
 }
Beispiel #5
0
 public void OnEnable()
 {
     if (target)
     {
         table = (SoundTable)target;
         if (!Application.isPlaying)
         {
             table.Init();
         }
     }
 }
Beispiel #6
0
    public static SoundData GetSoundData(string p_tableName, string p_soundKey)
    {
        SoundData _soundData = null;

        SoundTable _table = GetTable(p_tableName);

        if (_table != null)
        {
            _soundData = _table.GetSoundData(p_soundKey);
        }

        return(_soundData);
    }
Beispiel #7
0
    public static string GetSoundPath(int dicId)
    {
        if (SoundTable.Count == 0)
        {
            ReloadSoundTable();
        }

        IRecord record;

        if (SoundTable.TryGetValue(dicId, out record))
        {
            return(((SoundRecord)record).FullPathName);
        }
        return("null");
    }
Beispiel #8
0
    private void Awake()
    {
        soundDic = new Dictionary <string, AudioClip>();

        soundTable = ResourceManager.LoadAsset(tablePath, "SoundTable", resLinkType) as SoundTable;

        seAudio   = this.gameObject.AddComponent <AudioSource>();
        bgmAudio0 = this.gameObject.AddComponent <AudioSource>();
        bgmAudio1 = this.gameObject.AddComponent <AudioSource>();

        bgmAudio0.loop = true;
        bgmAudio1.loop = true;

        seAudio.volume   = 0f;
        bgmAudio0.volume = 0f;
        bgmAudio1.volume = 0f;

        DontDestroyOnLoad(this.gameObject);
    }
    public override void doDie(Creature killer)
    {
        GameTowerInstance gti = killer as GameTowerInstance;

        SwarmController.getInstance().notifySoldierKilled(_spawnZoneSource, gti.getSpawn());
        LevelManager.getInstance().notifyEnemyKilled(getEnemyTemplate());

        World.getInstance().unregisterEnemy(this);

        _gameInstance.GetComponent <EnemyController> ().enabled = false;
        _gameInstance.GetComponent <HealthBarController> ().destroy();

        _gameInstance.AddComponent <AudioSource> ().loop = false;
        SoundTable.getInstance().getAudioPlayer(_gameInstance.GetComponent <AudioSource> (), "sound_enemy_death");
        _gameInstance.GetComponent <AudioSource> ().Play();
        _gameInstance.GetComponent <Animator> ().SetBool("Death", true);
        _gameInstance.AddComponent <EnemyDeathController> ();

        //GameObject.Destroy (_gameInstance);
    }
Beispiel #10
0
//	[Button("GetTable")] public string getTableBut = "";
    public static SoundTable GetTable(string p_name)
    {
        SoundTable _table = null;

        if (!tableDict.TryGetValue(p_name, out _table))
        {
            string _path = "SoundTable/" + p_name;
            _table = Resources.Load <SoundTable>(_path);
            if (_table != null)
            {
                string _configName = _table.config.name;
                if (!configDict.ContainsKey(_configName))
                {
                    GetConfig(_configName);
                }

                List <SoundTable> _tableList = _table.config.tableList;
                if (!tableInConfigDict.ContainsKey(_configName))
                {
                    tableInConfigDict.Add(_configName, _tableList);
                }

                Debug.Log("Load Sound Table [" + _table.name + "]");
                tableDict.Add(p_name, _table);

                _tableList.Add(_table);
                _table.Init();
            }
            else
            {
                Debug.LogError("No Sound Table : [Resources/" + _path + "]");
            }
        }

        return(_table);
    }
Beispiel #11
0
 public void endLevelCleanup()
 {
     SoundTable.getInstance().onMatchEnd();
 }
Beispiel #12
0
 public void Init(SoundTable p_table)
 {
     table        = p_table;
     soundObjDict = new Dictionary <int, SoundPlayObj> ();
 }
Beispiel #13
0
    static bool ReadExcelFile(string excelPath, string prefabPath)
    {
        lastMsg = string.Empty;

        try
        {
            Excel itemData = ExcelHelper.LoadExcel(excelPath);

            if (itemData == null)
            {
                return(false);
            }

            List <ExcelTable> itemDataTable = itemData.Tables;

            string           prefabFilePath = prefabPath + "/SoundTable.asset";
            ScriptableObject soundTableSO   = (ScriptableObject)AssetDatabase.LoadAssetAtPath(prefabFilePath, typeof(ScriptableObject));
            if (soundTableSO == null)
            {
                soundTableSO = ScriptableObject.CreateInstance <SoundTable>();
                AssetDatabase.CreateAsset(soundTableSO, prefabFilePath);
                soundTableSO.hideFlags = HideFlags.NotEditable;
            }

            SoundTable soundDataTable = (SoundTable)soundTableSO;

            soundDataTable.soundInfoList.Clear();

            if (itemDataTable.Count > 0)
            {
                for (int i = 0; i < itemDataTable.Count; i++)
                {
                    if (itemDataTable[i].TableName == "KR")
                    {
                        int indexColumn = 0;
                        int pathColumn  = 0;
                        int tagColumn   = 0;

                        for (int column = 1; column <= itemDataTable[i].NumberOfColumns; column++)
                        {
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "Index")
                            {
                                indexColumn = column;
                            }
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "Path")
                            {
                                pathColumn = column;
                            }
                            if (Convert.ToString(itemDataTable[i].GetValue(1, column)) == "Tag")
                            {
                                tagColumn = column;
                            }
                        }

                        for (int row = 2; row <= itemDataTable[i].NumberOfRows; row++)
                        {
                            if (Convert.ToString(itemDataTable[i].GetValue(row, indexColumn)).Equals(""))
                            {
                                continue;
                            }

                            int    index = Convert.ToInt32(itemDataTable[i].GetValue(row, indexColumn));
                            string path  = Convert.ToString(itemDataTable[i].GetValue(row, pathColumn));
                            string tag   = Convert.ToString(itemDataTable[i].GetValue(row, tagColumn));

                            SoundTable.SoundInfo soundInfo = new SoundTable.SoundInfo();

                            soundInfo.index = index;
                            soundInfo.path  = path;
                            soundInfo.tag   = tag;

                            soundDataTable.soundInfoList.Add(soundInfo);
                        }
                    }
                }

                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();

                EditorUtility.SetDirty(soundTableSO);
                lastMsg = "Succeeded import data to prefab file : " + prefabFilePath;
            }
            else
            {
                lastMsg = "Result : Fail. Reason : Data was not found.";
            }

            return(true);
        } catch (Exception e)
        {
            UnityEngine.Debug.Log(e.Message);
            lastMsg = "Result : fail\nMessage : " + e.Message;
            return(false);
        } finally {
        }
    }
Beispiel #14
0
    private void LoadSoundData()
    {
        string filePath = Path.Combine(Application.streamingAssetsPath, m_SoundSource);

        m_SoundTable = JsonUtility.FromJson <SoundTable>(File.ReadAllText(filePath));
    }
Beispiel #15
0
 /// <summary>
 /// リストのセット
 /// </summary>
 /// <param name="list"></param>
 public void SetSoundsList(SoundTable list)
 {
     sounds = list;
 }
Beispiel #16
0
 /// <summary>
 /// リストのセット
 /// </summary>
 /// <param name="list"></param>
 public void SetSoundList(SoundList list)
 {
     sounds = list.Table;
 }
Beispiel #17
0
 public SoundData(SoundTable p_table)
 {
     table = p_table;
 }