//This function is for video recording and may be removed in the future //public void AddAnomalousEvent(Vector2 position) { // //Debug.Log (anomalousEventJson["anomalousEvents"].AsArray.Count); // JSONNode anEvent = anomalousEventJson["anomalousEvents"].AsArray[Random.Range(0, anomalousEventJson["anomalousEvents"].AsArray.Count)];//["event"]; // List<string> tempTagList = new List<string>(); // List<GridLocation> tempGridNumLocationList = new List<GridLocation>(); // int gridNum = 0; // foreach (JSONNode tag in anEvent["tags"].AsArray) { // tempTagList.Add(tag.ToString()); // } // for (int i = 0; i < anEvent["numberOfSpawns"].AsInt; i++) { // tempGridNumLocationList.Add(new GridLocation(position, gridNum, 0)); // } // EventList.Add(IDGenerator++, new AnomalousEvent(tempTagList, tempGridNumLocationList, anEvent["descriptionText"], "AnomalousLocationMarker")); // EventList[IDGenerator - 1].gridNumToLocations[0].statusCode = 2; // EventList[IDGenerator - 1].ShowEventMarker(EventList[IDGenerator - 1].gridNumToLocations[0], true, false, false); //} public void AddGOIEvent(List<string> tagList, string description) { AnomalousEvent anEvent = new AnomalousEvent(IDGenerator++, description, "AnomalousLocationMarker", false); anEvent.gridNumToLocations.Add(GeoscapeVariables.WM.GenerateGridLocation()); EventList.Add(anEvent.ID, anEvent); }
private void AddAnomalousEvent(bool isHerring = false) { //Select random event JSONNode anEvent = anomalousEventJson[anomalousEventFileName].AsArray[Random.Range(0, anomalousEventJson["anomalousEvents"].AsArray.Count)]; //Setup AnomalousEvent tempEvent = new AnomalousEvent(IDGenerator++, anEvent["descriptionText"], "AnomalousLocationMarker", isHerring); //Read in tag data foreach (JSONNode tag in anEvent["tags"].AsArray) { tempEvent.tags.Add(tag.ToString()); } Debug.Log(anomalousEventJson); Debug.Log(anomalousEventJson[anomalousEventFileName]); Debug.Log(anEvent); //Set spawn locations for (int i = 0; i < anEvent["numberOfSpawns"].AsInt; i++) { GridLocation location = new GridLocation(); if (anEvent["worldWide"].AsBool) { Debug.Log("worldwide spawn"); location = GeoscapeVariables.WM.GenerateGridLocation(); } else if (!anEvent["specificGrid"].AsBool) { Debug.Log("region spawn"); List<int> tempGridList = new List<int>(); foreach (JSONNode region in anEvent["regions"].AsArray) tempGridList.AddRange(GeoscapeVariables.WM.RegionList[region.AsInt].gridSquares); location = GeoscapeVariables.WM.GenerateGridLocation(tempGridList); } else { Debug.Log("specific grid spawn"); location = GeoscapeVariables.WM.GenerateGridLocation(anEvent["gridLocations"].AsArray[i].AsInt); } tempEvent.regions.Add(location.regionCode); tempEvent.gridNumToLocations.Add(location); } EventList.Add(tempEvent.ID, tempEvent); }