private void Start() { InitializeDecoratorPrefabs(); m_ChunkProcessor = new ChunkProcessor(); m_WorldData = new WorldData(m_ChunkProcessor); m_ChunksParent = transform.FindChild("Chunks"); m_ChunkMover = new ChunkMover(m_WorldData, m_ChunkProcessor); // Only the dual layer terrain w/ medium valleys and standard terrain medium caves // currently work, I haven't updated the others to return sunlit blocks. BatchPoolProcessor <Chunk> batchProcessor = new BatchPoolProcessor <Chunk>(); WorldDecorator worldDecorator = new WorldDecorator(WorldData, batchProcessor, m_ChunkProcessor); m_World = new World(WorldData, new TerrainGenerator(WorldData, m_ChunkProcessor, batchProcessor, new DualLayerTerrainWithMediumValleys()), new LightProcessor(batchProcessor, WorldData, m_ChunkProcessor), new MeshDataGenerator(batchProcessor, WorldData, m_ChunkProcessor), worldDecorator, m_ChunkProcessor); m_World.InitializeGridChunks(); InitializeTextures(); Player.transform.position = new Vector3(WorldData.WidthInBlocks / 2, 120, WorldData.HeightInBlocks / 2); CreateWorldChunkPrefabs(); m_World.StartProcessingThread(); m_PlayerChunkPosition = CurrentPlayerChunkPosition(); }
private static ChunkMover GetInstance() { if (instance == null) { instance = FindObjectOfType <ChunkMover>(); } return(instance); }
void OnTriggerEnter2D(Collider2D other) { print(other.tag); if (other.tag == "Player" && !_intoTheCaves) { ChunkMover mover = other.gameObject.GetComponent <ChunkMover>(); StartCoroutine(HackitHeiluu()); print("LUOLIIIN.." + mover.UnderGround); if (mover.UnderGround) { // maan päälle fireplace.SetActive(false); _tilemap.EnableTileMap(); MobsControl.instance.DeleteAllCurrentMobs(); mover.UnderGround = false; MapGenerator.Instance.DestroyCave(); GameObject player = GameObject.FindGameObjectWithTag("Player"); player.GetComponent <UpdatePathFind>().tilemap = GameObject.FindGameObjectWithTag("Tilemap").GetComponent <TileMap>(); player.GetComponent <UpdatePathFind>().path.map = GameObject.FindGameObjectWithTag("Tilemap").GetComponent <TileMap>(); int[] m = player.GetComponent <UpdatePathFind>().path.calculateIndex(player.transform.position); player.GetComponent <UpdatePathFind>().path.uptadeTiles(m[0], m[1], GameObject.FindGameObjectWithTag("Tilemap").GetComponent <TileMap>()); ParticleSpawner.instance.destroybloods(); MobsControl.instance.cave = false; player.GetComponent <FishSpawner>().enabled = true; } else { // maan Alle _tilemap.DisableTileMap(); MobsControl.instance.DeleteAllCurrentMobs(); Activate(); mover.UnderGround = true; MapGenerator dungeon = MapGenerator.Instance; var go = GameObject.FindWithTag("SpriteController"); TileSpriteController tileSpriteController = go.GetComponent <TileSpriteController>(); tileSpriteController.ResetAllTiles(); tileSpriteController.SetTileSprites(dungeon.Width - 1, dungeon.Height - 1, dungeon, 1, 1); GameObject player = GameObject.FindGameObjectWithTag("Player"); player.GetComponent <UpdatePathFind>().tilemap = dungeon; int[] m = player.GetComponent <UpdatePathFind>().path.calculateIndex(player.transform.position); player.GetComponent <UpdatePathFind>().path.uptadeTiles(m[0], m[1], dungeon); MobsControl.instance._door = this.gameObject; MobsControl.instance.cave = true; //player.GetComponent<UpdatePathFind>().path.uptadeTiles(player.transform.position,dungeon); if (!spawnedMobs) { spawnCaveMobs(); spawnedMobs = true; } else { spawnCreadedMobs(); } ParticleSpawner.instance.destroybloods(); player.GetComponent <FishSpawner>().enabled = false; } } }
private void Start() { m_PrefabsByName = new Dictionary<string, Transform>(); InitializeDecoratorPrefabs(); m_ChunkProcessor = new ChunkProcessor(); m_WorldData = new WorldData(m_ChunkProcessor); m_ChunksParent = transform.FindChild("Chunks"); m_ChunkMover = new ChunkMover(m_WorldData, m_ChunkProcessor); // Only the dual layer terrain w/ medium valleys and standard terrain medium caves // currently work, I haven't updated the others to return sunlit blocks. BatchPoolProcessor<Chunk> batchProcessor = new BatchPoolProcessor<Chunk>(); WorldDecorator worldDecorator = new WorldDecorator(WorldData, batchProcessor); m_MeshDataGenerator = new MeshDataGenerator(batchProcessor, WorldData, m_ChunkProcessor); m_World = new World(WorldData, new TerrainGenerator(WorldData, m_ChunkProcessor, batchProcessor, new DualLayerTerrainWithMediumValleys()), new LightProcessor(batchProcessor, WorldData, m_ChunkProcessor), m_MeshDataGenerator, worldDecorator, m_ChunkProcessor); m_World.InitializeGridChunks(); InitializeTextures(); Player.transform.position = new Vector3(WorldData.WidthInBlocks / 2, 120, WorldData.HeightInBlocks / 2); CreateWorldChunkPrefabs(); m_World.StartProcessingThread(); m_PlayerChunkPosition = CurrentPlayerChunkPosition(); m_LastPlayerLocation = Player.position; }