private void OnMapGenerationDone(Map map) { GameObject game = new GameObject("GameModel"); WorldSimulation model = game.AddComponent <WorldSimulation>(); model.Init(map); }
void Start() { _game = gameObject.GetComponent<MainProxy>(); _sim = gameObject.GetComponent<WorldSimulation>(); _uiHook = FindObjectOfType<CheatMenuHook>(); _uiHook.hideContent(); }
public void Update(WorldSimulation Model, GameEventHandler Handler) { switch (State) { case ExecutionState.ZoomIn: if (!CameraHandler.IsMoving) { Execute(Model, Handler); State = ExecutionState.Zoomed; } break; case ExecutionState.Zoomed: if (CameraCurrentFocusTime < CameraFocusTime) { CameraCurrentFocusTime += Time.deltaTime; } else { State = ExecutionState.ZoomOut; CameraHandler.ReturnToDefaultView(); } break; case ExecutionState.ZoomOut: if (!CameraHandler.IsMoving) { ExecutionDone(Handler); } break; } }
public virtual void InitExecution(WorldSimulation Model) { CameraCurrentFocusTime = 0f; if (CameraHandler == null) { CameraHandler = Camera.main.GetComponent <CameraHandler>(); } State = ExecutionState.ZoomIn; }
public override void InitExecution(WorldSimulation Model) { base.InitExecution(Model); List <Region> candidates = Model.Map.Regions.Where(x => !x.IsWater && x.Nation == null).ToList(); Capital = candidates[Random.Range(0, candidates.Count)]; CameraHandler.MoveToFocusRegion(Capital); }
public void initialize(MainProxy game) { _game = game; onPoinerExit(); _targetInstance = Instantiate(target); _targetInstance.transform.position = new Vector3(-100f, 100f); _seedTargetInstance = Instantiate(seedTarget); _seedTargetInstance.transform.position = new Vector3(-100f, 100f); _sim = FindObjectOfType <WorldSimulation>(); }
public void initialize(MainProxy game) { _game = game; onPoinerExit(); _targetInstance = Instantiate(target); _targetInstance.transform.position = new Vector3(-100f, 100f); _seedTargetInstance = Instantiate(seedTarget); _seedTargetInstance.transform.position = new Vector3(-100f, 100f); _sim = FindObjectOfType<WorldSimulation>(); }
public GTA2Game(string mapName, string styleName) { map = new Map.Map(mapName, styleName); map.CalcCoord(); _physics = new WorldSimulation(map); sprites = new Sprites(); GameObject.spriteAtlas = sprites; pedList = new List <Pedestrian>(); Pedestrian ped = new Pedestrian(new Vector3(65, 178, 5)); pedList.Add(ped); _physics.AddPed(ped); debugDraw = false; }
public override void InitExecution(WorldSimulation Model) { base.InitExecution(Model); NewProvince = Candidates[Random.Range(0, Candidates.Count)]; List <Nation> nationCandidates = new List <Nation>(); foreach (Region r in NewProvince.AdjacentRegions) { if (r.Nation != null && !nationCandidates.Contains(r.Nation)) { nationCandidates.Add(r.Nation); } } CapturingNation = nationCandidates[Random.Range(0, nationCandidates.Count)]; CameraHandler.MoveToFocusRegion(NewProvince); }
private void button1_Click(object sender, EventArgs e) { simulation = new WorldSimulation(); drawing = new DrawService(simulation.WorldSize); sw = Stopwatch.StartNew(); simulation.RunSimulation(); sw.Stop(); var time = sw.ElapsedMilliseconds; simulation.statistic.AlgorithmTime = time; var table = drawing.ConstructDataTable(simulation.allAgents); this.worldView.DataSource = table; for (int i = 0; i < worldView.ColumnCount; i++) { worldView.Columns[i].Width = width; } MessageBox.Show($"Simulation is completed."); }
public GameEventHandler(WorldSimulation model) { Model = model; }
protected abstract void Execute(WorldSimulation Model, GameEventHandler Handler);
void Start() { state = GameState.AWAITING_CONNECT; _connection = gameObject.AddComponent<Connection>(); _loginMenu = gameObject.AddComponent<LoginScreenLogic>(); _cheatMenu = gameObject.AddComponent<CheatMenuLogic>(); _simulation = gameObject.AddComponent<WorldSimulation>(); _abil = FindObjectOfType<AbilitiesMenuHook>(); _abil.hide (); }
protected override void Execute(WorldSimulation Model, GameEventHandler Hanlder) { Nation newNation = Model.CreateNation(Capital); Model.AddLog("A new nation " + newNation.Name + " has emerged. It has called its capital " + newNation.Capital.Name + "."); }
public override int GetProbability(WorldSimulation Model) { return((int)(Model.Map.Regions.Where(x => !x.IsWater && x.Nation == null).Count() * 0.3f)); }
public abstract int GetProbability(WorldSimulation Model);
protected override void Execute(WorldSimulation Model, GameEventHandler Handler) { Model.CaptureRegion(CapturingNation, NewProvince); Model.AddLog("The nation " + CapturingNation.Name + " has expanded. It has called its new province " + NewProvince.Name); }
public override int GetProbability(WorldSimulation Model) { Candidates = Model.Map.Regions.Where(x => !x.IsWater && x.Nation == null && x.AdjacentRegions.Any(y => y.Nation != null)).ToList(); return(Candidates.Count); }