// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } //app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); app.UseCookiePolicy(); GMobsList.init(); GItemsList.init(); GWorld.init(); }
public override bool PostPerform() { if (cubicle != null) { inventory.RemoveItem(cubicle); GWorld.Instance().Cubicles.Add(cubicle); } return(true); }
public override bool PostPerform() { GWorld.Instance().WorldStates.IncrementState(AgentStates.patientsWaiting, 1); GWorld.Instance().Waiting.Add(GetComponent <Patient>()); // !!! This is getting into Gworld somehow, check Gplanner needs to make a copy of the world state and not operate on it. agentBeliefs.AddState(AgentStates.atHospital, 1); return(true); }
// Update is called once per frame void Update() { worldstates = GWorld.Instance().WorldStates.States; states.text = ""; foreach (KeyValuePair <AgentStates, int> keyValuePair in worldstates) { states.text += keyValuePair.Key + " , " + keyValuePair.Value; states.text += "\n"; } }
public Queue <GAction> plan(List <GAction> actions, Dictionary <AgentStates, int> goal, WorldStates beliefStates) { List <GAction> usableActions = actions.Where(gAction => gAction.IsAchievable()).ToList(); List <Node> leaves = new List <Node>(); // Node start = new Node(parent: null, cost: 0, new Dictionary<AgentStates, int>(GWorld.Instance().WorldStates.States), beliefStates.States, null); Node start = new Node(parent: null, cost: 0, GWorld.Instance().WorldStates.States, beliefStates.States, null); bool success = BuildGraph(start, leaves, usableActions, goal); //TODO: Leaves is an output; if (!success) { Debug.Log("NO PLAN FOUND"); return(null); } //find best leaf Node cheapest = FindCheapestLeaf(leaves); //GetParentList List <GAction> result = new List <GAction>(); Node n = cheapest; while (n != null) { if (n.action != null) { result.Insert(0, n.action); } n = n.parent; } Queue <GAction> queue = new Queue <GAction>(); foreach (GAction gAction in result) { queue.Enqueue(gAction); } Debug.Log("the plan is : "); foreach (GAction gAction in queue) { Debug.Log("Q: " + gAction.actionName); } return(queue); }
public void Selector(int mode, string path) { switch ((int)mode) { case 0: GWorld world = new GWorld(); world.Start(path); break; case 1: break; case 2: break; } }
public override bool PrePerform() { if (GWorld.Instance().Waiting.IsEmpty()) { return(false); } patient = GWorld.Instance().Waiting.Remove(); if (patient == null) { return(false); } target = patient.gameObject; cubicle = GWorld.Instance().Cubicles.Remove(); if (cubicle == null) { GWorld.Instance().Waiting.Add(patient); return(false); } inventory.AddItem(cubicle); GWorld.Instance().WorldStates.IncrementState(AgentStates.Waiting, -1); return(true); }
public unsafe void InitItems(GWorld *world) { string value = null; if (this.PlayersGrid.Items.Count > 0) { this.PlayersGrid.Items.Clear(); } int num = 0; do { GPlayer * ptr = < Module >.GWorld.GetPlayer(world, num); ArrayList arrayList = new ArrayList(); arrayList.Add(string.Format("{0}", num + 1)); switch (*(int *)(ptr + 4 / sizeof(GPlayer))) { case 0: value = new string((sbyte *)(& < Module >.?? _C@_05IHOOPELI@Iraqi?$AA@)); break; case 1: value = new string((sbyte *)(& < Module >.?? _C@_03OHIEPGFF@JTF?$AA@)); break; case 2: value = new string((sbyte *)(& < Module >.?? _C@_07NDGKDAPO@Bosnian?$AA@)); break; case 3: value = new string((sbyte *)(& < Module >.?? _C@_08NKKMBANE@Somalian?$AA@)); break; case 4: value = new string((sbyte *)(& < Module >.?? _C@_09LDEFILLJ@Colombian?$AA@)); break; case 5: value = new string((sbyte *)(& < Module >.?? _C@_06DJKJCBIE@Afghan?$AA@)); break; } arrayList.Add(value); switch (*(int *)(ptr + 8 / sizeof(GPlayer))) { case 0: value = new string((sbyte *)(& < Module >.?? _C@_05OHCDHBAC@Human?$AA@)); break; case 1: value = new string((sbyte *)(& < Module >.?? _C@_08JABLAMKL@Computer?$AA@)); break; case 2: value = new string((sbyte *)(& < Module >.?? _C@_07GJJCKENN@Neutral?$AA@)); break; case 3: value = new string((sbyte *)(& < Module >.?? _C@_09BIDEJFLN@Rescuable?$AA@)); break; case 4: value = new string((sbyte *)(& < Module >.?? _C@_03KNAPCKEA@Spy?$AA@)); break; case 5: value = new string((sbyte *)(& < Module >.?? _C@_05JDMJBIOG@Civil?$AA@)); break; } arrayList.Add(value); arrayList.Add(string.Format("{0}", *(int *)(ptr + 16 / sizeof(GPlayer)))); arrayList.Add(string.Format("{0}", *(int *)ptr)); this.PlayersGrid.Items.Add(arrayList); num++; }while (num < 12); this.PlayersGrid.UpdateViewHeight(); }
// Start is called before the first frame update void Start() { worldstates = GWorld.Instance().WorldStates.States; }
public static string GeneratorActorSpecialNameInEditor(string origionName, GWorld world) { if (world == null || string.IsNullOrEmpty(origionName)) { return(origionName); } int index = 1; bool isSameName = false; var actors = new List <EngineNS.GamePlay.Actor.GActor>(world.Actors.Values); actors.Sort((EngineNS.GamePlay.Actor.GActor a, EngineNS.GamePlay.Actor.GActor b) => { if (a.SpecialName == null && b.SpecialName == null) { return(0); } if (a.SpecialName != null && b.SpecialName == null) { return(1); } if (a.SpecialName == null && b.SpecialName != null) { return(-1); } return(a.SpecialName.CompareTo(b.SpecialName)); }); foreach (var actor in actors) { var spName = actor.SpecialName; if (string.IsNullOrEmpty(spName)) { continue; } if (!spName.Contains(origionName)) { continue; } isSameName = true; var idx1 = spName.LastIndexOf('('); if (idx1 < 0) { continue; } else { try { origionName = origionName.Substring(0, idx1); var idx2 = spName.LastIndexOf(')'); int idx = -1; if (int.TryParse(spName.Substring(idx1 + 1, idx2 - idx1 - 1), out idx)) { if (index <= idx) { index = idx + 1; } } } catch (System.Exception) { } } } if (!isSameName) { return(origionName); } else { return(origionName + "(" + (index) + ")"); } }
public void ShouldNotBeNull() { Assert.IsNotNull(GWorld.Instance()); }
public void CanAccessWorld() { Assert.IsNotNull(GWorld.Instance().WorldStates); }