public void initiate() { poolmanager.instance.initiate(); elementaryAffection.instance.initiate(); if (_player == null) { _player = new GameObject("player"); playermanager playermanager = _player.AddComponent <playermanager>(); playermanager.lives = 10; playermanager.resources.fireResources = 100; playermanager.resources.airResources = 100; playermanager.resources.earthResources = 100; playermanager.resources.waterResources = 100; playermanager.initiate(); playermanager.updatePlayerUI(); } if (_map == null) { _map = new GameObject("(" + mapSize + "x" + mapSize + ") map"); mapData data = _map.AddComponent <mapData>(); mapGfx gfx = _map.AddComponent <mapGfx>(); mapGenerator generator = _map.AddComponent <mapGenerator>(); List <string> layerNames = new List <string>() { "ground", "path", "decoration", "tower" }; data.mapSize = mapSize; data.layers = layerNames; data.initiate(); layerNames.Add("waypoint"); layerNames.Add("border"); gfx.prefixIdentifier = new List <string>() { "basis", "border", "ground", "spawn", "bottomLeftPath", "bottomRightPath", "horizontalPath", "upperLeftPath", "upperRightPath", "verticalPath" }; gfx.initiate(layerNames); generator.buildBoardFoundation(data, gfx); generator.buildRandomBoard(data, gfx); gfx.instantiateBoard(data.getBoard(), data.mapSize); createWavesystem(generator.startWaypoint); } else { Destroy(_map); _map = null; Destroy(_wavesystem); _wavesystem = null; elementaryAffection.instance.reset(); initiate(); } }
void Awake() { instance = this; }
private void Awake() { instance = this; }