void OnSceneGUI(SceneView sceneView) { if (!Application.isEditor || Application.isPlaying || !initSuccessful || currentScene.name != "MapScene") { return; } HandleUtility.AddDefaultControl(GUIUtility.GetControlID(FocusType.Passive)); if (Event.current.button == 0) { if (Event.current.type == EventType.MouseDown) { var tile = GetMousePositionTile <SpawnTile>(); if (tile != selectedTile) { if (tile is CastleSpawnTile) { SetNewCastle(tile as CastleSpawnTile); } else if (tile is InteractableSpawnTile) { SetSelectedTile(tile as InteractableSpawnTile); } } selectedTile = tile; Repaint(); } else if (Event.current.type == EventType.MouseDrag) { } } }
void SetNewCastle(CastleSpawnTile newTile) { selectedTile = newTile; if (subEditor != null) { DestroyImmediate(subEditor); } if (newTile != null && newTile.countryData != null && newTile.countryData.country != null) { subEditor = Editor.CreateEditor(newTile.countryData); } }
/// <summary> /// Method for initializing the maps with a setup of a normal ludo map. /// </summary> /// private void initializeMaps() { //Instantiate map array. Maps = new Map[5]; //Initialize maps sharedMap = (Maps[(int)MapSection.SHARED] = new Map(size: (int)MapSectionSize.SHARED, isLoopMap: true)); redMap = (Maps[(int)MapSection.RED] = new Map(size: (int)MapSectionSize.RED, isLoopMap: false)); blueMap = (Maps[(int)MapSection.BLUE] = new Map(size: (int)MapSectionSize.BLUE, isLoopMap: false)); yellowMap = (Maps[(int)MapSection.YELLOW] = new Map(size: (int)MapSectionSize.YELLOW, isLoopMap: false)); greenMap = (Maps[(int)MapSection.GREEN] = new Map(size: (int)MapSectionSize.GREEN, isLoopMap: false)); sharedMap.Name = "SharedMap"; redMap.Name = "RedMap"; blueMap.Name = "BlueMap"; yellowMap.Name = "YellowMap"; greenMap.Name = "GreenMap"; // Defines Team specific maps Map[] submaps = { redMap, greenMap, yellowMap, blueMap }; // creates Team Special tiles on the shared map for (int i = 0; i < submaps.Length; i++) { int idx = i * ((int)(MapSectionSize.SHARED) / 4); Tile newTile = new ExitTile(sharedMap, idx, submaps[i].FirstTile, (PlayerTeam)(i)); sharedMap.SetTile(idx, newTile); //Create exit tiles. newTile = new SpawnTile(sharedMap, idx + 2, (PlayerTeam)(i)); sharedMap.SetTile(idx + 2, newTile); //Create spawn tiles. newTile = new EndTile(submaps[i], submaps[i].Tiles.Length - 1, (PlayerTeam)(i)); submaps[i].LastTile = newTile; //Create end tiles. } // Set tile actors foreach (Map map in Maps) { foreach (Tile tile in map.Tiles) { tile.Actor = new ConsoleTileActor(Game.GetConsoleActorMatrix(), tile); } } }
// Use this for initialization void Awake() { if (wave == null) { wave = this; DontDestroyOnLoad(gameObject); Level1Scene.level1Scene.instantiedLevel1GameObjects.Add(gameObject); spawnTile = spawnTileGameObject.GetComponent <SpawnTile>(); waveScale = waveScaleGameObject.GetComponent <WaveScale>(); } else { if (this != wave) { Destroy(gameObject); } } }
public void StartGame() { GameManager.instance.GhostOffset = Vector3.zero; GameManager.instance.UpdateRank(); GameManager.instance.audioManager.Stop("Fanfare"); GameManager.instance.audioManager.Stop("Main Menu"); GameManager.instance.audioManager.Play(battle_music); ResetCurves(); string s = "Starting round with players: "; foreach (Player player in players) { s += player.playerNumber.ToString() + ", "; } //Debug.Log(s); //Debug.Log("This is where the round indeed starts amirighte?"); SceneManager.SetActiveScene(roundScene); StartTime = Time.time; GameManager.instance.weatherManager.ChangeWeather(1); TileManager.tileManager.StartGame(); ItemSpawner.Instance.UpdateSpawnPoints(TileManager.tileManager.tileMap); Queue <SpawnTile> spawnPoints = new Queue <SpawnTile>(TileManager.tileManager.tileMap.SpawnTiles); moveCamera = Camera.main.GetComponentInParent <FollowTargetsCamera>(); foreach (Player player in players) { player.ResetForRound(); SpawnTile spawnTile = spawnPoints.Dequeue(); player.SetController(Instantiate <GameObject>(GameManager.instance.PlayerPrefab.gameObject, spawnTile.transform.position, Quaternion.identity).GetComponent <PlayerController>()); moveCamera.targets.Add(player.controller.gameObject); activePlayersControllers.Add(player.controller.gameObject); player.OnHurt += Player_onHurt; player.OnDeath += Player_onDeath; } State = GameState.Battle; GameManager.instance.StartCoroutine(Update()); }
void SetSelectedTile(SpawnTile newTile) { selectedTile = newTile; }