void OnPBLoaded(GameObject pb_cache, ref Transform _ground, GROUND_TYPE ground_type) { if (pb_cache != null) { //if (pb_cache == null) //{ // GameObject g_pb_new = obj as GameObject; // pb_cache = g_pb_new; //} if (_ground == null) { if (_GroundT != null && pb_cache != null) { GameObject g_g = CUnityUtil.Instantiate(pb_cache) as GameObject; if (g_g != null) { _ground = g_g.transform; _ground.SetParent(_GroundT, false); g_g.name = ground_type.ToString(); //g_g.SetActive(GroundType == ground_type); } } } } }
public void LoadGroundDestroySound(GROUND_TYPE type, string path) // Destroy sound { if (tileMap.DestroySoundEffects.ContainsKey(GroundType)) { destroySoundEffect = tileMap.DestroySoundEffects[GroundType]; } else { tileMap.AddDestroySoundEffect(GroundType, path); destroySoundEffect = tileMap.DestroySoundEffects[GroundType]; } }
// Load Ground Content public void LoadGroundTexture(GROUND_TYPE type, string path) // Texture { if (tileMap.TileSets.ContainsKey(type)) { tileTexture = tileMap.TileSets[type]; } else { tileMap.AddTileSet(type, path); tileTexture = tileMap.TileSets[type]; } }
// Create a type fo ground public static Ground MakeGround(GameScreen screen, TileMap tileMap, GROUND_TYPE groundType) { switch (groundType) { case GROUND_TYPE.DIRT: return(new Dirt(screen, tileMap)); case GROUND_TYPE.STONE: return(new Stone(screen, tileMap)); } return(null); }
private void StepSound(GROUND_TYPE groundType) // TODO: movement type että juokseeko vaiko kävelee vai sneakkaa vai mitä { switch (groundType) { case GROUND_TYPE.DIRT: audioS.PlayOneShot(stepSounds.dirt[Random.Range(0, stepSounds.dirt.Length)]); break; default: break; } }
private void SpawnGround(GROUND_TYPE type, int count = 1) { string blockName; GameObject block; List <string> groundType = new List <string>(); foreach (var item in groundNames) { if (item.Contains(type.ToString())) { groundType.Add(item); } } //По дефолту спавнится 1 блок, но можно указать и несколько // Из нового списка с однотипными блоками выбираем случайный, для того чтобы его заспавнить for (int i = 0; i < count; i++) { blockName = groundType[Random.Range(0, groundType.Count)]; if (isTest == "") { block = pooler.SpawnFromPool(blockName, new Vector3(0, 0, -20), Quaternion.identity); } else { block = pooler.SpawnFromPool(isTest, new Vector3(0, 0, -20), Quaternion.identity); } block.transform.position = currentEdge; //Край блока var blockEdge = block.transform.Find("edge").transform.position; currentLastBlock = block; currentEdge = blockEdge; spawnedGroundLog.Add(type); blockCount++; // Сообщаем что заспавнили блок земли Notification(block); } //Debug.Log($"Спавним - {spawnedGroundLog.Last().ToString()}"); //Debug.Log($"Блоков до босса - {blockCount}"); }
private GROUND_TYPE GetRandomGround(bool withBoss = false, params GROUND_TYPE[] ExTypes) { GROUND_TYPE randomType = (GROUND_TYPE)Random.Range(1, countOfTypes + 1); // По дефолту босс исключается из рандомной выдачи блоков //Если нет исключений , ролим любой блок и возвращаем if (!withBoss) { while (ExTypes.Contains(randomType) || (randomType == GROUND_TYPE.withBoss)) { randomType = (GROUND_TYPE)Random.Range(1, countOfTypes + 1); } } else { while (ExTypes.Contains(randomType)) { randomType = (GROUND_TYPE)Random.Range(1, countOfTypes + 1); } } return(randomType); }