private void DownloadLevelMap() { LogisticAPI.Instance.GetLevelMap( res => { try { Map = LevelMap.Create(res); ShowLevesLoaded(Map.CountLevels()); } catch (IllegalLevelMapExeption ex) { Debug.LogError(ex); }; }, err => { try { Map = LevelMap.Create(JsonConvert.DeserializeObject <LevelRowModel[]>(LevelMapData.text)); ShowLevesLoaded(Map.CountLevels()); } catch (IllegalLevelMapExeption ex) { Debug.LogError(ex); }; Debug.LogError("Levelmap cant be loaded - " + err); } ); }
/// <summary> /// Deletes the tile at the given index in the map. /// Sets all connections to that tile to null /// </summary> /// <param name="room"></param> /// <param name="index"></param> public static void deleteTile(LevelMap room, int index) { // if another node in the map has a connection to this node, set that connection to null for (int k = 0; k < room.size; k++) { // j is index of moved node // room[k] is node to check // List<ConnectionSet> connectionList is list of connections on node to check for (int i = 0; i < 4; i++) { if (room[k].defaultConn[i] == index) { room[k].defaultConn[i] = -1; } if (room[k].defaultConn[i] == index) { room[k].defaultConn[i] = -1; } } } // if deleting the source node for a map, find first valid node in the map and set that to be a source node. if (index == room.sourceNodeIndex) { for (int k = 0; k < room.size; k++) { if ((room[k] != null) && (room[k].index >= 0) && (room[k].index != index)) { setType(room, k, Node.TileType.source); } } } room[index] = null; }
// Loads the next level, if one is available, and starts it running with the // profiler. If there are no levels left, returns false. private bool StartNextLevel() { CommonData.gameWorld.DisposeWorld(); nextLevelIndex++; while (nextLevelIndex < levelDir.levels.Count && levelDir.levels[nextLevelIndex].replay == null) { nextLevelIndex++; } if (nextLevelIndex >= levelDir.levels.Count) { CommonData.currentReplayData = null; return(false); } CommonData.currentReplayData = levelDir.levels[nextLevelIndex].replay; TextAsset json = Resources.Load(levelDir.levels[nextLevelIndex].filename) as TextAsset; LevelMap currentLevel = JsonUtility.FromJson <LevelMap>(json.ToString()); currentLevel.DatabasePath = null; CommonData.gameWorld.SpawnWorld(currentLevel); manager.PushState(new Gameplay(Gameplay.GameplayMode.TestLoop)); profiler.Initialize(); return(true); }
/// <summary> /// Saves a level using the given name and filepath within the assest folder /// Note that this is a relative filepath from the assests folder, not the absolute filepath /// </summary> public void saveLevel() { //Debug.Log("WTF, is this not being called?"); getCurrentMap(); // make sure map reference is current LevelEditor_2.cleanUpMap(currentMap); // clean up the map, removing deleted or invalid tiles if (File.Exists(Application.dataPath + levelPath + "/room_" + levelName + ".json")) // if it already exists, check wether the person intends to overwrite it { if (overwriteLevel) { LevelMap.Save(currentMap, Application.dataPath + levelPath + "/room_" + levelName + ".json"); Debug.Log("Overwriting level at: \"" + Application.dataPath + levelPath + "/room_" + levelName + ".json\""); overwriteLevel = false; } else { // If the overwriteLevel boolean is not set, do not overwrite the level Debug.Log("Are you sure you want to overwrite the level at: \"" + Application.dataPath + levelPath + "/room_" + levelName + ".json\" ?"); } } else { // if it doesn't already exit, don't need to make any checks. Debug.Log("Saving level at: \"" + Application.dataPath + levelPath + "/room_" + levelName + ".json\""); LevelMap.Save(currentMap, Application.dataPath + levelPath + "/room_" + levelName + ".json"); } }
// Resume the state. Called when the state becomes active // when the state above is removed. That state may send an // optional object containing any results/data. Results // can also just be null, if no data is sent. public override void Resume(StateExitValue results) { CommonData.mainGame.SelectAndPlayMusic(CommonData.prefabs.menuMusic, true); ShowUI(); CommonData.gameWorld.RespawnWorld(); CommonData.mainCamera.mode = CameraController.CameraMode.Editor; if (results != null) { if (results.sourceState == typeof(WaitingForDBLoad <LevelMap>)) { var resultData = results.data as WaitingForDBLoad <LevelMap> .Results; if (resultData.wasSuccessful && resultData.results != null) { currentLevel = resultData.results; currentLevel.DatabasePath = resultData.path; CommonData.gameWorld.DisposeWorld(); CommonData.gameWorld.SpawnWorld(currentLevel); Debug.Log("Map load complete!"); } else { Debug.LogWarning("Map load complete, but not successful..."); } } } UpdateCameraController(); }
public Cell(LevelMap map, CellType t, Point p) { this.Map = map; this.Type = t; this.Position = p; this.Arrived = this.Type == CellType.Floor; }
// Save the current map to the database. If no mapID is provided, // a new id is created. Otherwise, it saves over the existing ID. void SaveMapToDB(string mapId) { if (mapId == null) { mapId = CommonData.currentUser.GetUniqueKey(); } string path = CommonData.DBMapTablePath + mapId; DBStruct <LevelMap> dbLevel = new DBStruct <LevelMap>(path, CommonData.app); LevelMap currentLevel = CommonData.gameWorld.worldMap; currentLevel.SetProperties(dialogComponent.MapName.text, mapId, CommonData.currentUser.data.id, path); CommonData.gameWorld.OnSave(); dbLevel.Initialize(currentLevel); dbLevel.PushData(); Firebase.Analytics.FirebaseAnalytics.LogEvent(StringConstants.AnalyticsEventMapCreated, StringConstants.AnalyticsParamMapId, CommonData.gameWorld.worldMap.mapId); Social.ReportProgress(GPGSIds.achievement_map_maker, 100.0f, (bool success) => { Debug.Log("Edit a game achiement unlocked. Sucess: " + success); }); CommonData.currentUser.data.AddMap(currentLevel.name, currentLevel.mapId); CommonData.currentUser.PushData(); manager.PopState(); }
private void Start() { pickedSpawnIndex = new List <int>(); players = new PlayerController[PhotonNetwork.PlayerList.Length - NetworkManager.instance.spectator.Count]; bots = new BotController[players.Length * 2]; foreach (string name in NetworkManager.instance.spectator) { Debug.Log(name); } Debug.Log(players.Length); if (!NetworkManager.instance.spectator.Contains(PhotonNetwork.NickName)) { PlayerHUD.SetActive(true); clocks = GameObject.Find("Timer"); photonView.RPC("ImInGame", RpcTarget.AllBuffered); clocks.GetComponent <ChessClockController>().startClock = true; } if (PhotonNetwork.IsMasterClient) { levelMap = NetworkManager.instance.levelMap; photonView.RPC("SetLevelMap", RpcTarget.All, (int)levelMap); } mapController.SetSpeed(playerSpeed); grid.hexesTravelled = 0; }
// Initialization method. Called after the state // is added to the stack. public override void Initialize() { CommonData.mainGame.SelectAndPlayMusic(CommonData.prefabs.menuMusic, true); menuComponent = SpawnUI <Menus.EditorGUI>(StringConstants.PrefabEditorMenu); // Set up our map to edit, and populate the data // structure with the necessary IDs. string mapId = CommonData.currentUser.GetUniqueKey(); currentLevel = new LevelMap(); CommonData.gameWorld.worldMap.SetProperties(StringConstants.DefaultMapName, mapId, CommonData.currentUser.data.id, null); UpdateCameraController(); CommonData.mainCamera.mode = CameraController.CameraMode.Editor; SpawnToolButtons(0); UpdateOrientationIndicator(); #if !UNITY_EDITOR // This button is a debug function, for easily exporting premade // maps during development. It should never show up on // actual release builds. menuComponent.ExportButton.gameObject.SetActive(false); // This button is a developer tool, for easily creating bonus levels. // It is not intended to be public-facing. menuComponent.BonusButton.gameObject.SetActive(false); #endif }
public static void createTwoWayLink(LevelMap room, int fromIndex, int toIndex, GameManager.Direction dir) { int opposite = ((int)dir + 2) % 4; room[fromIndex].defaultConn[(int)dir] = room[toIndex].index; room[toIndex].defaultConn[opposite] = room[fromIndex].index; }
void Start() { level_map = GetLinkedObject("map_obj").GetComponent <LevelMap>(); char_manager = GetComponent <CharactersManager>(); characters_camera = GetLinkedObject("characters_camera"); player_enemies_manager = GetLinkedObject("player_enemies_manager"); Audio.StopAllSounds(); audio = GetComponent <CompAudio>(); audio.PlayEvent("PlayMusic"); Audio.ChangeState("MusicState", "None"); curr_dir = (Direction)start_direction; update_rotation = false; map_width = Map.GetWidthMap(); map_height = Map.GetHeightMap(); endPosition = GetComponent <Transform>().local_position; endRotation = GetComponent <Transform>().local_rotation; //SET PLAYER INTO THE CORRECT MAP TILE level_map.GetPositionByeValue(out curr_x, out curr_y, 2); //2 = player start position level_map.UpdateMap(curr_x, curr_y, 0); MovePositionInitial(new Vector3((float)curr_x * distanceToMove, GetComponent <Transform>().local_position.y, (float)curr_y * distanceToMove)); drowning = false; }
// Save the current map to the database. If no mapID is provided, // a new id is created. Otherwise, it saves over the existing ID. void SaveMapToDB(string mapId) { if (mapId == null) { mapId = CommonData.currentUser.GetUniqueKey(); } string path = CommonData.DBMapTablePath + mapId; DBStruct <LevelMap> dbLevel = new DBStruct <LevelMap>(path, CommonData.app); LevelMap currentLevel = CommonData.gameWorld.worldMap; currentLevel.SetProperties(dialogComponent.MapName.text, mapId, CommonData.currentUser.data.id, path); CommonData.gameWorld.OnSave(); dbLevel.Initialize(currentLevel); dbLevel.PushData(); Firebase.Analytics.FirebaseAnalytics.LogEvent(StringConstants.AnalyticsEventMapCreated, StringConstants.AnalyticsParamMapId, CommonData.gameWorld.worldMap.mapId); CommonData.currentUser.data.AddMap(currentLevel.name, currentLevel.mapId); CommonData.currentUser.PushData(); manager.PopState(); }
void OnEnable() { if (location) { DestroyImmediate(location.gameObject); } main = this; content.gameObject.SetActive(true); mapCamera.gameObject.SetActive(true); UpdateMapParameters(); if (content.childCount == 0) { int target_level = 1; if (LevelProfile.main != null) { target_level = LevelProfile.main.level; } else { target_level = ProfileAssistant.main.local_profile.current_level; } Transform rect = Instantiate(locationPrefab.transform); rect.name = locationPrefab.name; rect.parent = content; rect.localPosition = Vector3.zero; rect.localScale = Vector3.one; MapLocation map_location = rect.gameObject.GetComponent <MapLocation>(); Vector3 position = mapCamera.transform.position; position.y = (map_location.nextLocationConnector.position.y + map_location.previousLocationConnector.position.y) / 2; mapCamera.transform.position = position; } }
void Awake() { main = this; if (content == null) { content = new GameObject("Map").transform; content.gameObject.layer = LayerMask.NameToLayer("Map"); } if (mapCamera == null) { mapCamera = new GameObject("MapCamera").AddComponent <Camera>(); mapCamera.orthographic = true; mapCamera.clearFlags = CameraClearFlags.SolidColor; mapCamera.backgroundColor = Color.black; mapCamera.cullingMask = 1 << LayerMask.NameToLayer("Map"); mapCamera.transform.position = new Vector3(0, 0, -10); } UIAssistant.onScreenResize += UpdateMapParameters; UpdateMapParameters(); mapCamera.orthographicSize = camSizeMax; spawnOffset *= Mathf.Max(Screen.width, Screen.height); UIAssistant.onShowPage += (string page) => { if (page == "LevelList") { UpdateMap(); } }; }
/// <summary> /// Copy relevant data to new map, that uses new node type /// </summary> /// <param name="oldMap"></param> /// <returns></returns> public static LevelMap ConvertToNew(LevelMap_old oldMap) { if (oldMap.version != 0) { Debug.Log("Error: map is not version 0, cannot convert to version 1"); return(null); } LevelMap newMap = new LevelMap(); newMap.version = 1; newMap.defaultPosition = oldMap.defaultPosition; // copy map info newMap.sourceNodeIndex = oldMap.sourceNodeIndex; newMap.targetNodeIndex = oldMap.targetNodeIndex; newMap.checkpoints = new int[oldMap.checkpoints.Length]; for (int i = 0; i < oldMap.checkpoints.Length; i++) { newMap.checkpoints[i] = oldMap.checkpoints[i]; } newMap.stringleft = oldMap.stringleft; Node[] newNodes = new Node[oldMap.size]; for (int i = 0; i < oldMap.size; i++) { newNodes[i] = oldMap[i].ConvertToNew(); // create matching nodes of the new type } newMap.setNodes(newNodes); //set corner-drawing. return(newMap); }
void Start() { pauseCanvas.SetActive(false); paused = false; SceneManager.sceneLoaded += OnSceneLoaded; string startScene = "Level1"; currentScene = startScene; LevelMap.GetLevelMapObject().onLoadLevel(); if (CutsceneMode) { SetHUDVisibility(false); } string sceneName = SceneManager.GetActiveScene().name; if (sceneName.Equals(currentScene)) { //samescene // LevelMap.GetLevelMapObject().onLoadLevel(); // MyGlobal.GetPlayerObject().transform.position = (Vector3)respawnPosition; } else { currentScene = sceneName; // respawnPosition = null; } }
public UnlockedLevelData() { this.Troops = new LevelMap(); this.Starships = new LevelMap(); this.Buildings = new LevelMap(); this.Equipment = new LevelMap(); }
void Start() { levelMap = new LevelMap(); tilemap = GetComponentInChildren <Tilemap>(); int sizeX = 50; int sizeY = 30; levelMap.Init(sizeX, sizeY, 5, 4, 10); DrawGridFromMap(); // Fit tile map to screen. Vector3 boardSize = tilemap.localBounds.size; float screenRatio = (float)Screen.width / (float)Screen.height; float targetRatio = boardSize.x / boardSize.y; if (screenRatio >= targetRatio) { Camera.main.orthographicSize = boardSize.y / 2; } else { float differenceInSize = targetRatio / screenRatio; Camera.main.orthographicSize = boardSize.y / 2 * differenceInSize; } // Center grid inside camera view. Camera.main.transform.position = new Vector3((boardSize.x * 0.5f), (boardSize.y * 0.5f), Camera.main.transform.position.z); }
/// <summary> /// Define or redefine a Level using the values in the <see cref="LevelEntry"/> argument /// </summary> /// <param name="levelEntry">the level values</param> /// <remarks> /// <para> /// Define or redefine a Level using the values in the <see cref="LevelEntry"/> argument /// </para> /// <para> /// Supports setting levels via the configuration file. /// </para> /// </remarks> internal void AddLevel(LevelEntry levelEntry) { if (levelEntry == null) { throw new ArgumentNullException("levelEntry"); } if (levelEntry.Name == null) { throw new ArgumentNullException("levelEntry.Name"); } // Lookup replacement value if (levelEntry.Value == -1) { Level previousLevel = LevelMap[levelEntry.Name]; if (previousLevel == null) { throw new InvalidOperationException("Cannot redefine level [" + levelEntry.Name + "] because it is not defined in the LevelMap. To define the level supply the level value."); } levelEntry.Value = previousLevel.Value; } LevelMap.Add(levelEntry.Name, levelEntry.Value, levelEntry.DisplayName); }
void Start() { audio = GetComponent <CompAudio>(); Vector3 global_pos = transform.GetGlobalPosition(); Debug.Log(global_pos); tile_x = (int)((global_pos.x + (12.7f)) / 25.4); tile_z = (int)((global_pos.z + (12.7f)) / 25.4); if (trap_walkable) { global_pos.y = min_height; value = 0; } else { global_pos.y = max_height; value = 1; } GetComponent <Transform>().SetGlobalPosition(global_pos); Debug.Log(global_pos); map = GetLinkedObject("map_obj"); LevelMap map_level = map.GetComponent <LevelMap>(); if (map_level != null) { map_level.UpdateMap(tile_x, tile_z, value); } curr_state = CHANGE_STATE.TRAP_IDLE; }
void Start() { slider_width.minValue = MIN_SLIDER_VALUE; slider_height.minValue = slider_width.minValue; selected_width.GetComponent <Text>().text = slider_width.minValue + ""; selected_height.GetComponent <Text>().text = slider_height.minValue + ""; current_maps_hash = LevelMap.LoadCurrentMapsHash(); }
public void Initialize(LevelMap map) { this.map = map; setNewGoal(); computePathToGoal(); state = EnemyState.Wander; }
// Use this for initialization void Start() { levelMap = GameObject.Find("LevelMap").GetComponent <LevelMap> (); transform.rotation = Quaternion.Euler(transform.eulerAngles.x, 0f, transform.eulerAngles.z); laneAimed = 2; bullets = maxBullets; playerState = (int)rotatingStates.stopped; }
public static LevelMap GetRandomMap() { List <string> names = MapParser.GetMapNamesFromJSON(); int randNum = UnityEngine.Random.Range(0, names.Count); LevelMap map = MapParser.GetLevelMapFromJSON(names[randNum]); return(map); }
/// <summary> /// Creates an exact duplicate of this map /// </summary> /// <returns></returns> public LevelMap Clone() { LevelMap _ = new LevelMap(Width, Height, Tile.ByName("Blank")) { _data = this._data.Clone() as Tile[, ] }; return(_); }
public ViridesPuirr( Game game, int index ) : base(game, index) { Player player = Player.CreateNewHarapAlb( game ); Enemy bugEnemy = Enemy.CreateBugEnemy( game ); LevelMap = new LevelMap( player, bugEnemy, Assets.ViridesPuirrBackground, Assets.ViridesPuirrBackgroundMask ); }
public static LevelSimulationSnapshot Create(LevelMap map) { var iterator = new TwoDimensionalIterator(map.Width, map.Height); var floors = new List <TilePoint>(); var disengagedFailsafes = new List <TilePoint>(); var oneHealthSubroutines = new List <TilePoint>(); var twoHealthSubroutines = new List <TilePoint>(); var iceSubroutines = new List <TilePoint>(); var dataCubes = new List <TilePoint>(); var root = new TilePoint(-999, -999); var rootKey = new TilePoint(-999, -999); iterator.ForEach(t => { var(x, y) = t; var point = new TilePoint(x, y); if (map.FloorLayer[x, y] == MapPiece.Floor) { floors.Add(point); } if (map.FloorLayer[x, y] == MapPiece.FailsafeFloor) { disengagedFailsafes.Add(point); } if (map.ObjectLayer[x, y] == MapPiece.Routine) { oneHealthSubroutines.Add(point); } if (map.ObjectLayer[x, y] == MapPiece.DoubleRoutine) { twoHealthSubroutines.Add(point); } if (map.ObjectLayer[x, y] == MapPiece.JumpingRoutine) { iceSubroutines.Add(point); } if (map.ObjectLayer[x, y] == MapPiece.DataCube) { dataCubes.Add(point); } if (map.ObjectLayer[x, y] == MapPiece.Root) { root = point; } if (map.ObjectLayer[x, y] == MapPiece.RootKey) { rootKey = point; } }); if (root.X == -999 || rootKey.X == -999) { throw new ArgumentException($"Map {map.Name} is missing it's Root or Root Key!"); } return(new LevelSimulationSnapshot(floors, disengagedFailsafes, oneHealthSubroutines, twoHealthSubroutines, iceSubroutines, dataCubes, root, rootKey)); }
public LevelRunner(MiNetServer server, LevelMap map) { _server = server; Map = map; Map.OnTileUpdated += MapOnOnTileUpdated; _timer = new Timer(DoUpdate); }
public EllyuteionLake( Game game, int index ) : base(game, index) { Player player = Player.CreateNewHarapAlb( game ); Enemy bugEnemy = Enemy.CreateBugEnemy( game ); LevelMap = new LevelMap( player, bugEnemy, Assets.EllyuteionLakeBackground, Assets.EllyuteionLakeBackgroundMask ); }
public MirrosHills( Game game, int index ) : base(game, index) { Player player = Player.CreateNewHarapAlb( game ); Enemy bugEnemy = Enemy.CreateBugEnemy( game ); LevelMap = new LevelMap( player, bugEnemy, Assets.MirrosHillsBackground, Assets.MirrosHillsBackgroundMask ); }
public LevelMapRegion(LevelMap map, RegionPosition pos) { Map = map; Position = pos; FilePath = Path.Combine(map.TilesDirectory, "meta", $"{Position.X}_{Position.Z}.json"); Load(); }
public LevelMap GenerateMap() { var map = new LevelMap(GridSizeX, GridSizeY); GenerateRoomsOnMap(map); // Select one of the furthest rooms as final room; SetFinalRoomOnMap(map); return(map); }
public Pandorashys( Game game, int index ) : base(game, index) { Player player = Player.CreateNewHarapAlb( game ); Enemy enemy = Enemy.CreateSkeletEnemy( game ); LevelMap = new LevelMap( player, enemy, Assets.PandorashysBackground, Assets.PandorashysBackgroundMask ); }
private List <int[]> getNeighborLevelMaps(int target_ind_x, int target_ind_y, ref LevelMap[,] WorldLevelMaps) { List <int[]> neighbors = new List <int[]> (8); for (int i = 0; i < 8; ++i) { neighbors.Add(new int[side_tile_count]); } LevelMap originalLevelMap = WorldLevelMaps [target_ind_y, target_ind_x]; LevelMap lmap; LevelMapOrientation current; LevelMapOrientation oposite; current = LevelMapOrientation.N; oposite = LevelMapOrientation.S; lmap = getNeighborLevelMap(originalLevelMap, current, ref WorldLevelMaps); neighbors[(int)current] = getLevelMapBorder(ref lmap, oposite); current = LevelMapOrientation.NE; oposite = LevelMapOrientation.SW; lmap = getNeighborLevelMap(originalLevelMap, current, ref WorldLevelMaps); neighbors[(int)current] = getLevelMapBorder(ref lmap, oposite); current = LevelMapOrientation.E; oposite = LevelMapOrientation.W; lmap = getNeighborLevelMap(originalLevelMap, current, ref WorldLevelMaps); neighbors[(int)current] = getLevelMapBorder(ref lmap, oposite); current = LevelMapOrientation.SE; oposite = LevelMapOrientation.NW; lmap = getNeighborLevelMap(originalLevelMap, current, ref WorldLevelMaps); neighbors[(int)current] = getLevelMapBorder(ref lmap, oposite); current = LevelMapOrientation.S; oposite = LevelMapOrientation.N; lmap = getNeighborLevelMap(originalLevelMap, current, ref WorldLevelMaps); neighbors[(int)current] = getLevelMapBorder(ref lmap, oposite); current = LevelMapOrientation.SW; oposite = LevelMapOrientation.NE; lmap = getNeighborLevelMap(originalLevelMap, current, ref WorldLevelMaps); neighbors[(int)current] = getLevelMapBorder(ref lmap, oposite); current = LevelMapOrientation.W; oposite = LevelMapOrientation.E; lmap = getNeighborLevelMap(originalLevelMap, current, ref WorldLevelMaps); neighbors[(int)current] = getLevelMapBorder(ref lmap, oposite); current = LevelMapOrientation.NW; oposite = LevelMapOrientation.SE; lmap = getNeighborLevelMap(originalLevelMap, current, ref WorldLevelMaps); neighbors[(int)current] = getLevelMapBorder(ref lmap, oposite); return(neighbors); }
public override void Enter() { ShowMouse(false); GameObject gameHUDObject = UIManager.GetInstance().InstantiateForegroundUI(UIManager.GetInstance().GameplayHUD); _gameHUD = gameHUDObject.GetComponent<GameplayHUD>(); _gameHUD.Init(); _levelMap = LevelObjectManager.GetInstance().InstantiateLevel(_levelName); _levelMap.Player.Init(_gameHUD); _levelMap.Player.PlayerDead += OnPlayerDead; _levelMap.Player.KilledEnemy += OnEnemyDead; }
public override void generateMap(LevelMap map) { featuresCount = 0; roomsCount = 0; corridorsCount = 0; levelMap = map; levelMap.initialize(rows, columns); setupWorld(); putHero(); createExit(); createMonsters(); map.initPathFinder(); createTorchs(); }
public void OnLoad(EventArgs e) { camera = new Camera(); camera.LoadProjection(); entities = new List<Entity>(); player = new Player(); map = new LevelMap(new Texture("Resources/Levels/" + level + ".png"), new Texture("Resources/Levels/" + level + "_col.png")); helpFont = new QFont("Resources/Fonts/anarchysans.ttf", 22); helpFont.Options.Colour = Color4.DarkRed; using (StreamReader reader = new StreamReader("Resources/Levels/" + level + ".txt")) { while (!reader.EndOfStream) { string line = reader.ReadLine(); string[] values = line.Split(' '); Vector2 pos = new Vector2(int.Parse(values[1]), int.Parse(values[2])); switch (values[0]) { case "Spawn": player.Position = pos; player.Position = pos; break; case "Generator": generator = new Generator(pos); entities.Add(generator); break; case "Lift": lift = new Lift(pos); entities.Add(lift); break; case "Pickaxe": entities.Add(new Pickaxe(pos, 0, true)); break; case "PickaxeB": entities.Add(new Pickaxe(pos, 0, false)); break; case "Skeleton": entities.Add(new Skeleton(0, pos)); break; case "Goblin": entities.Add(new Goblin(pos)); break; case "GameEnd": entities.Add(new Endgame(pos)); break; } } } fadeIn = new Mesh(1024, 768, Texture.Zero); fadePercent = 1f; fadingIn = true; GL.Enable(EnableCap.Blend); GL.Enable(EnableCap.Texture2D); GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); }
public void initialize(LevelMap map) { this.map = map; }
private void InitLevelMap() { LevelMapDirector = new LevelMap (); LevelMapDirector.OnPathReadyEvent += OnCharacterPathReady; }
public abstract void generateMap(LevelMap map);
void Start() { controller = gameObject.GetComponent<PhantomController>(); tracker = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<LevelMap>(); }
public void createMap() { map = new GameObject("Map"); map.name = "Map"; mapComponent = map.AddComponent<LevelMap>(); }