public static WeatherControler getWeatherControler() { if (controler == null) { controler = new WeatherControler(); } return(controler); }
private map.Monster getMonster(float lat, float lng) { MonsterInfo info = MonsterInfo.getMonsterInfo(); List <string> landuses = landuseManager.getLanduse(lat, lng); List <string> monsterIds = new List <string>(); WeatherControler weatherCon = WeatherControler.getWeatherControler(); string time = weatherCon.getTime(); string weather = weatherCon.getWeather(lat, lng); if (weather == null || landuses == null) { return(null); } foreach (string landuse in landuses) //add monster that spawn cause of landuse { for (int i = 0; i < info.spawns[0][landuse][time][weather].Count; i++) { monsterIds.Add(info.spawns[0][landuse][time][weather][i]); } } int count = monsterIds.Count; for (int i = 0; i < info.spawns[1][time][weather].Count && monsterIds.Count < 3; i++) //if not enough variety, add some more { monsterIds.Add(info.spawns[1][time][weather][Random.Range(0, info.spawns[1][time][weather].Count)]); } for (int i = 0; i < count; i++)//prefer monster that spawned cause of landuse { for (int j = 0; j < System.Int32.Parse(MonsterInfo.getMonsterInfo().spawnData[monsterIds[i]]["rarity"].ToString().Replace("\"", "")); j++) { monsterIds.Add(monsterIds[i]); } } GameObject.Find("MonsterDex").transform.FindChild("Text").GetComponent <UnityEngine.UI.Text>().text = "wow"; GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Sphere); GameObject.Find("MonsterDex").transform.FindChild("Text").GetComponent <UnityEngine.UI.Text>().text = "SPHERE SUCKSSSSSSS"; obj.AddComponent <Animation>(); obj.AddComponent <MeshCollider>(); map.Monster monster = obj.AddComponent <map.Monster>(); monster.initiate(monsterIds[(int)Random.Range(0, monsterIds.Count)]); obj.GetComponent <Renderer>().material.color = monster.color; return(monster); }