protected override void Load() { // Make this able to be used a singleton Feast.Instance = this; // Set some variables to empty to start. this.drops = new List <Vector3>(); this.items = new List <Item>(); this.numItems = 0; this.Timer = new System.Timers.Timer(11500); this.Timer.Elapsed += this.Timer_Elapsed; this.Timer.AutoReset = false; this.Timer2 = new System.Timers.Timer(12800); this.Timer2.Elapsed += this.Timer_Elapsed; this.Timer2.AutoReset = false; this.effectNum = 0; // Did we load the configuration file? If not, just end. if (Configuration.Instance.Items == null || !Configuration.Instance.Items.Any()) { Logger.Log("Failed to load the configuration file. Turned off feast. Restart to try again."); return; } if (LevelNodes.nodes == null) { LevelNodes.load(); } }
//methods public void GenNodes() { nodeMatrix = new Node[16, 10]; LevelNodes.Clear(); for (int i = 0; i < levelMatrix.GetLength(1) - 1; i++) { for (int j = 0; j < levelMatrix.GetLength(0); j++) { //rework for the fly class if (LevelMatrix[j, i] == '-' || LevelMatrix[j, i] == 'R')//walls and rocks are not transfersable so they should not be made into nodes { nodeMatrix[j, i] = null; } else if (LevelMatrix[j, i] == 'P') { playerSpawn = new Node(j, i); levelNodes.Add(playerSpawn); nodeMatrix[j, i] = playerSpawn; } else { levelNodes.Add(new Node(j, i)); nodeMatrix[j, i] = new Node(j, i); } } } }
public void OnLevelWasLoaded() { if (LevelNodes.nodes == null) { LevelNodes.load(); } initializeNodes(); }
protected override void Load() { Feast.instance = this; this.locations = new List <Locs>(); this.maplocations = new List <Locs>(); if (LevelNodes.Nodes == null) { LevelNodes.load(); } foreach (Node n in LevelNodes.Nodes) { Locs loc = new Locs(n.Position, ((NodeLocation)n).Name); maplocations.Add(loc); } List <string> usedlocs = new List <string>(); if (this.Configuration.Items == null || !this.Configuration.Items.Any()) { Logger.Log("Failed to load the configuration file. Turned off feast. Restart to try again."); return; } ; List <FeastItem> items = new List <FeastItem>(); foreach (FeastItem f in this.Configuration.Items) { usedlocs = usedlocs.Concat(f.Location).ToList(); ItemAsset itemAsset = (ItemAsset)Assets.find(EAssetType.Item, f.Id); if (itemAsset != null && !itemAsset.Cosmetic) { items.Add(f); } } this.items = items; List <string> locations = usedlocs.Distinct().ToList(); if (locations.Contains("all") || locations.Contains("All")) { this.locations = maplocations; } else { foreach (Locs a in maplocations) { if (locations.IndexOf(a.Name()) != -1) { this.locations.Add(a); } } } this.running = true; this.resetFeast(); }