/* * public LevelMapBlock[,] LevelMapBlocks; * * public void GenerateMap(string levelName) * { * LevelMapBlocks = new LevelMapBlock[GameBoardWidth, GameBoardHeight]; * foreach (LevelMapBlock block in LevelMapBlocks) * { * if (block) * { * block.PoolRecycle(); * } * } * * LevelMap levelMap = LevelMapManager.Instance.LevelMaps[levelName]; * for (int i = 0; i < levelMap.LevelMapIndices.GetLength(0); i++) * { * for (int j = 0; j < levelMap.LevelMapIndices.GetLength(1); j++) * { * LevelMapBlock block = LevelMapBlock.InitializeBlock((AllLevelMapColors.MapBlockType) levelMap.LevelMapIndices[i, j], MapContainer, i, j); * LevelMapBlocks[i, j] = block; * } * } * * GenerateStarterGarbages(); * }*/ public void GenerateStarterGarbages() { for (int i = 0; i < GameManager.Instance.StarterFloorGarbage; i++) { GarbageMain gm = GameObjectPoolManager.Instance.Pool_Garbage.AllocateGameObject <GarbageMain>(GameBoardGarbagesCanvas.transform); gm.Initialize(); gm.transform.position = new Vector2(Random.Range(-MapContainer.rect.width / 2, MapContainer.rect.width / 2), Random.Range(-MapContainer.rect.height / 2, MapContainer.rect.height / 2)); Garbages.Add(gm); } }
void Drop(Vector2 vector2) { GarbageMain am = GameObjectPoolManager.Instance.Pool_Garbage.AllocateGameObject <GarbageMain>(GameBoardManager.Instance.GameBoardGarbagesCanvas.transform); am.Initialize(); am.CanPick = true; am.transform.position = transform.position; am.Rigidbody2D.velocity = RotateVector2(vector2.normalized, Random.Range(-60, 60)) * Random.Range(100, 200); am.Initialize(); }