Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Reus.Model.Civilizations;
- using Reus.Controller.Civilizations;
- using Microsoft.Xna.Framework;
- using Reus.Model;
- using Reus.IO;
- using SpaceTech.Content;
- using Reus.Controller;
- using SpaceTech;
- using Reus.Settings.Model;
- using Reus.Model.Flora;
- namespace GrowthRunner
- {
- class Program
- {
- private static ModelSettings modelSettings;
- public static void LoadModelSettings(string dir)
- {
- ReferencedContentManager referencedContentManager = new ReferencedContentManager(new ServiceProvider(), dir, new string[] { "" });
- IUnlockService unlockService = new UnlockManager();
- modelSettings = new ModelSettings(referencedContentManager, unlockService);
- }
- public static Planet CreatePlanet()
- {
- Planet planet = new Planet(Token.Null, false, GameMode.Freeplay);
- foreach (Patch p in planet.Surface)
- {
- p.Water = -1;
- }
- foreach (Patch p in planet.Surface)
- {
- p.FertileType = PatchType.Forest;
- }
- FloraAssetDefinition floraAssetDefinition = modelSettings.FloraDefinitions["Superior Blueberry"];
- FloraAssetDefinition floraAssetDefinition2 = modelSettings.FloraDefinitions["Superior Strawberry"];
- planet.Flora.SpawnFloraAsset(floraAssetDefinition, planet.Surface[47], new ScalableAssetStatWrapper(0, 0, 0, 0, 0));
- foreach (Patch p in planet.Surface)
- {
- //if (p.Index < 46 || p.Index > 53)
- {
- // planet.Flora.SpawnFloraAsset((p.Index%3) != 0 ? floraAssetDefinition : floraAssetDefinition2, p, new ScalableAssetStatWrapper(0, 0, 0, 0, 0));
- }
- }
- return planet;
- }
- static void Main(string[] args)
- {
- LoadModelSettings("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Reus\\");
- Planet planet = CreatePlanet();
- Civilization civ = new Civilization(planet, planet.Surface[50], 0.77f, "Testciv");
- Growth g = new Growth(civ);
- // run the initial tick
- g.Update(new GameTime(new TimeSpan(0, 0, (int)modelSettings.CivParams.Growth.TickTime), new TimeSpan(0, 0, (int)modelSettings.CivParams.Growth.TickTime)));
- int prevReachSize = 0;
- int tickOfLastIncrease = 0;
- int tickInSeconds = 1; // or (int)modelSettings.CivParams.Growth.TickTime;
- for (int i = 1; i < 120 * 60 / tickInSeconds; i++)
- {
- // GameTime gt = new GameTime(totalGameTime: new TimeSpan(0, 0, 0, i/10, (i%10)*100), elapsedGameTime: new TimeSpan(0,0,0,0,100)); // once per 0.1 s
- GameTime gt = new GameTime(totalGameTime: new TimeSpan(0, 0, tickInSeconds), elapsedGameTime: new TimeSpan(0, 0, tickInSeconds)); // once per TickTime
- g.Update(gt);
- if (civ.Reach.Length != prevReachSize)
- {
- Console.WriteLine("Reach changed on tick " + i + ", #ticks after previous:" + (i - tickOfLastIncrease));
- Console.WriteLine("Food use is now " + civ.Population + " (out of " + civ.TotalFood + ") ");
- tickOfLastIncrease = i;
- Console.WriteLine("Reach = " + civ.Reach.Length+ " squares: " + civ.Reach.First().Index + " to " + civ.Reach.Last().Index);
- prevReachSize = civ.Reach.Length;
- Console.ReadKey();
- }
- }
- Console.WriteLine("Press Enter ...");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement