private void InitMonster() { GameObject monster = null; if (GameObject.Find("MonsterBox") == null) { monster = new GameObject("MonsterBox"); } List <Monster> monsters = DataUtility.ReadInitMonsterData("1"); foreach (var item in monsters) { if (item.monsterType == MonsterType.Eagle) { GameObject go = LoadUtility.InstantiateMonsterPrefabs(PrefabConst.EaglePrefab, monster.transform, false); go.transform.position = item.Pos; } else if (item.monsterType == MonsterType.Opossum) { GameObject go = LoadUtility.InstantiateMonsterPrefabs(PrefabConst.OpossumPrefab, monster.transform, false); go.transform.position = item.Pos; } else { GameObject go = LoadUtility.InstantiateMonsterPrefabs(PrefabConst.FrogPrefab, monster.transform, false); go.transform.position = item.Pos; } } }
private static void InstantiateData(Player player, List <Monster> monsterList, List <Vector3> gemListPos, List <Vector3> cherryListPos) { GameObject role = LoadUtility.InstantiateOtherPrefabs(PrefabConst.Player, LoadUtility.OtherPath); role.transform.position = player.Pos; GameObject monster = null; if (GameObject.Find("MonsterBox") == null) { monster = new GameObject("MonsterBox"); } foreach (var item in monsterList) { if (item.monsterType == MonsterType.Eagle) { GameObject go = LoadUtility.InstantiateMonsterPrefabs(PrefabConst.EaglePrefab, monster.transform, false); go.transform.position = item.Pos; } else if (item.monsterType == MonsterType.Opossum) { GameObject go = LoadUtility.InstantiateMonsterPrefabs(PrefabConst.OpossumPrefab, monster.transform, false); go.transform.position = item.Pos; } else { GameObject go = LoadUtility.InstantiateMonsterPrefabs(PrefabConst.FrogPrefab, monster.transform, false); go.transform.position = item.Pos; } } GameObject gems = null; if (GameObject.Find("GemBox") == null) { gems = new GameObject("GemBox"); } foreach (var item in gemListPos) { GameObject go = LoadUtility.InstantiateOtherPrefabs(PrefabConst.GemPrefab, LoadUtility.GemPath, gems.transform); go.transform.position = item; } GameObject cherrys = null; if (GameObject.Find("CherryBox") == null) { cherrys = new GameObject("CherryBox"); } foreach (var item in cherryListPos) { GameObject go = LoadUtility.InstantiateOtherPrefabs(PrefabConst.CherryPrefab, LoadUtility.CherryPath, cherrys.transform); go.transform.position = item; } Log.Info("初始化成功"); }
public void DoEnqueue(Queue <FloatTextPrefab> queue, string desc) { GameObject go = LoadUtility.InstantiateUIPrefabs(PrefabConst.FloatTextPrefab, UIManager.Instance.ShowCanvasGo.transform, true); go.GetComponent <FloatTextPrefab>().DescText.text = desc; queue.Enqueue(go.GetComponent <FloatTextPrefab>()); MessageCenter.Instance.Send(MessageName.OnTellEnqueue); DoShowFT(go, 590f - 50 * (queue.Count - 1), 0.7f); }
private void InitPlayer() { GameObject player = LoadUtility.InstantiateOtherPrefabs(PrefabConst.Player, LoadUtility.OtherPath); Player data = DataUtility.ReadInitPlayerData("1"); player.transform.position = data.Pos; MessageData info = new MessageData(data); MessageCenter.Instance.Send(MessageName.OnNoticeInitPlayerData, info); }
private void InitCherry() { GameObject cherrys = null; if (GameObject.Find("CherryBox") == null) { cherrys = new GameObject("CherryBox"); } List <Vector3> lists = DataUtility.ReadInitCherryData("1"); for (int i = 0; i < lists.Count; i++) { GameObject go = LoadUtility.InstantiateOtherPrefabs(PrefabConst.CherryPrefab, LoadUtility.CherryPath, cherrys.transform); go.transform.position = lists[i]; } }
private void InitGem() { GameObject gems = null; if (GameObject.Find("GemBox") == null) { gems = new GameObject("GemBox"); } List <Vector3> lists = DataUtility.ReadInitGemData("1"); for (int i = 0; i < lists.Count; i++) { GameObject go = LoadUtility.InstantiateOtherPrefabs(PrefabConst.GemPrefab, LoadUtility.GemPath, gems.transform); go.transform.position = lists[i]; } }
public void Init() { GameObject go = LoadUICanvas(); GameObject.DontDestroyOnLoad(go); ShowUI(PrefabConst.MainPanel); CreateAudioListener(); CreateEventSystem(); //实例化音源 GameObject soundEffect = LoadUtility.InstantiateOtherPrefabs(PrefabConst.SoundEffects, LoadUtility.SoundPath, null); GameObject soundMusic = LoadUtility.InstantiateOtherPrefabs(PrefabConst.SoundMusic, LoadUtility.SoundPath, null); GameObject.DontDestroyOnLoad(soundEffect); GameObject.DontDestroyOnLoad(soundMusic); SetVolume(soundEffect.GetComponent <SoundEffect>(), soundMusic.GetComponent <SoundMusic>()); MessageData data = new MessageData(LevelBgm.MainPanel); MessageCenter.Instance.Send(MessageName.OnPlaySoundBgm, data); }
public void ShowUI(string name) { if (_hideUIDic != null && _hideUIDic.ContainsKey(name)) { MoveToShow(name); return; } if (_instantiatedDic == null) { _instantiatedDic = new Dictionary <string, GameObject>(); } if (_popUI == null) { _popUI = new Stack <GameObject>(); } GameObject go; go = LoadUtility.InstantiateUIPrefabs(name, ShowCanvasGo.transform, false); _instantiatedDic.Add(name, go); PushUI(go); }
void Awake() { instance = (LoadUtility)Singleton.Setup(this, instance); }
private void InitCamera() { GameObject camera = LoadUtility.InstantiateOtherPrefabs(PrefabConst.FollowCamera, LoadUtility.OtherPath); camera.transform.position = new Vector3(3, -3, 10); }