//processes the event associated with the node public void PopEvent() { if (NodeEvent == EventType.NONE) { return; } else if (NodeEvent == EventType.NARRATIVECORE) { startDialogue(); if (dialogueSet.Count == 1 && dialogueSet[0] == 0) { NodeEvent = EventType.NONE; } } else if (NodeEvent == EventType.COMBAT) { NodeEvent = EventType.NONE; GameObject MController = GameObject.Find("MapController"); Party.GetComponent <PartyProperties>().battleState.enemyID = Random.Range(1, 6); if (gameObject == MController.GetComponent <MapProperties>().Nodes[MController.GetComponent <MapProperties>().Nodes.Count - 1]) { Party.GetComponent <PartyProperties>().battleState.finalBattle = true; Party.GetComponent <PartyProperties>().battleState.enemyID = 6; Party.GetComponent <PartyProperties>().battleState.mapName = "Underground"; GameObject WinScreen = GameObject.FindWithTag("Overworld Canvas").GetComponent <OverlayUIScripts>().WinScreen; WinScreen.SetActive(true); //GameObject.FindWithTag("Overworld Canvas").GetComponent<MapProperties>().defeat(); } SavedLoad.savedHeroStats = Party.GetComponent <PartyProperties>().battleState; SavedLoad.Write(); GameObject.Find("MapController").GetComponent <AudioSource>().mute = true; SceneManager.LoadScene("TestBattle"); } else if (NodeEvent == EventType.NARRATIVE) { NodeEvent = EventType.NONE; GameObject Party = GameObject.FindWithTag("Overworld Party"); Party.GetComponent <PartyProperties>().ProccessResourceEvent(gameObject.GetComponent <NodeProperties>().ResourceMod); startDialogue(); if (dialogueSet.Count == 1 && dialogueSet[0] == 0) { NodeEvent = EventType.NONE; } } SetColor(); }
//initialize map private void Awake() { gridGen = new RectangularSquareGridGenerator(); battleState = SavedLoad.Read(); cellsParent = transform; squarePrefab = Resources.Load("Prefabs/SquareTile", typeof(GameObject)) as GameObject; //Load the map by name LoadMap(); //create the basic dimensions of the map with the tile template CreateGrid(); //populate the map PopulateTiles(); PopulateObstacles(); PopulateEnemies(); SetHeroStats(); }