public EditRoleViewModel(AgentRole role) { this.RoleID = role.Id; this.OriginalRoleName = role.Name; this.RoleName = role.Name; this.Description = role.Description; }
public void JoinBlueTeam(AgentRole role) { agentRole = role; team = Team.Blue; m_AgentRenderer.material = m_Academy.blueMaterial; tag = "blueAgent"; }
public void JoinBlueTeam(AgentRole role) { agentRole = role; team = Team.Blue; m_AgentRenderer.material = m_SoccerSettings.blueMaterial; tag = "blueAgent"; }
public void JoinRedTeam(AgentRole role) { agentRole = role; team = Team.Red; agentRenderer.material = academy.redMaterial; tag = "redAgent"; }
public AgentStateStatic(AgentStateStatic clone) { name = clone.name; role = clone.role; hasHashCode = clone.hasHashCode; hashCode = clone.hashCode; }
public void JoinPurpleTeam(AgentRole role) { agentRole = role; team = Team.Purple; m_AgentRenderer.material = m_Academy.purpleMaterial; tag = "purpleAgent"; }
public void Elevate(int aimFloor, int currentAgentFloor, AgentRole role) { switch (elevatorStatus) { case ElevatorStatus.Down: GoDown(aimFloor, currentAgentFloor, role); break; case ElevatorStatus.Up: GoUp(aimFloor, currentAgentFloor, role); break; case ElevatorStatus.Stopped: if (CurrentFloor < currentAgentFloor) { GoUp(aimFloor, currentAgentFloor, role); } else if (CurrentFloor > currentAgentFloor) { GoDown(aimFloor, currentAgentFloor, role); } else { Stop(aimFloor, currentAgentFloor, role); } break; } }
public void JoinPurpleTeam(AgentRole role) { agentRole = role; team = Team.Purple; m_AgentRenderer.material = m_SoccerSettings.purpleMaterial; tag = "purpleAgent"; }
public void JoinPurpleTeam(AgentRole role) // 퍼플팀의 역할을 부여, 초기화 관련 함수 { agentRole = role; // 역할 team = Team.Purple; // 퍼플팀에 넣음 m_AgentRenderer.material = m_Academy.purpleMaterial; // 채색 tag = "purpleAgent"; //퍼플에이전트로 태깅 }
/// <summary> /// Method-constructor of the static part of the agent (without input parameters). /// </summary> public AgentStateStatic() { name = ""; role = AgentRole.USUAL; hasHashCode = false; hashCode = 0; }
public BeliefsAboutAgent(AgentStateStatic info, AgentRole role, bool isAlive, LocationStatic inLocation, AgentAngryAt angryAt) { this.info = info; this.role = role; this.isAlive = isAlive; this.inLocation = inLocation; this.angryAt = angryAt; }
public NetworkAgent(AgentRole role, string tag) { _role = role; _config = new NetPeerConfiguration(tag); _incomingMessages = new List<NetIncomingMessage>(); Initialize(); }
/// <summary> /// Method-constructor of the static part of the agent (with input parameters). /// </summary> /// <param name="name"></param> /// <param name="role"></param> public AgentStateStatic(string name, AgentRole role) { // We assign the specified name and role. SetName(name); AssignRole(role); hasHashCode = false; hashCode = 0; }
public BeliefsAboutAgent() { info = new AgentStateStatic(); role = AgentRole.USUAL; isAlive = true; inLocation = new LocationStatic(); angryAt = new AgentAngryAt(); }
public BeliefsAboutAgent(BeliefsAboutAgent clone) { info = (AgentStateStatic)clone.info.Clone(); role = clone.role; isAlive = clone.isAlive; inLocation = (LocationStatic)clone.inLocation.Clone(); angryAt = (AgentAngryAt)clone.angryAt.Clone(); }
public void JoinBlueTeam(AgentRole role) { agentRole = role; team = Team.blue; for (int i = 0; i < transform.GetChild(0).childCount; ++i) { transform.GetChild(0).GetChild(i).gameObject.GetComponent <Renderer>().material = academy.blueMaterial; } }
public NetworkAgent(AgentRole role, string tag) { _role = role; _config = new NetPeerConfiguration(tag); _incomingMessages = new List <NetIncomingMessage>(); Initialize(); }
/// <summary> /// Returns the first founded agent with the specified role. /// </summary> /// <param name="role"></param> public KeyValuePair <AgentStateStatic, AgentStateDynamic> GetAgentByRole(AgentRole role) { foreach (var agent in agents.Where(a => a.Key.GetRole().Equals(role))) { return(agent); } throw new KeyNotFoundException(); }
public KeyValuePair <AgentStateStatic, AgentRole> GetAgentByRole(AgentRole role) { foreach (var agent in agentsInWorld) { if (agent.GetRole() == role) { return(new KeyValuePair <AgentStateStatic, AgentRole>(agent.GetInfo(), agent.GetRole())); } } throw new KeyNotFoundException(); }
public bool CanGetOffElevator(int chosenFloor, AgentRole role) { if (role == AgentRole.Confidential && chosenFloor > 0) { return(false); } else if (role == AgentRole.Secret && chosenFloor >= 2) { return(false); } else { return(true); } }
public void GoDown(int aimFloor, int currentAgentFloor, AgentRole role) { elevatorStatus = ElevatorStatus.Down; for (int i = CurrentFloor; i >= 0; i--) { Thread.Sleep(1000); Console.WriteLine($"The Elevator is on {i + 1} floor."); if (currentAgentFloor == i) { Stop(aimFloor, i, role); break; } else { continue; } } }
public void AddAgent(AgentRole role, bool status, string name) { AgentStateStatic newAgentStateStatic = new AgentStateStatic(); AgentStateDynamic newAgentStateDynamic = new AgentStateDynamic(); newAgentStateStatic.AssignRole(role); newAgentStateStatic.SetName(name); newAgentStateDynamic.SetStatus(status); agents.Add(newAgentStateStatic, newAgentStateDynamic); // Очистка newAgentStateStatic = null; newAgentStateDynamic = null; GC.Collect(); UpdateHashCode(); }
public MessageQueueRunner(string id, AgentRole role, TimeSpan delayMin, TimeSpan delayMax) { this.Id = id; this.Role = role; this.DelayMin = delayMin; this.DelayMax = delayMax; this.TimeLine = new RobustTimeLine( TimeSpan.FromSeconds(5), onCompleted: (histo, idx) => { Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0,3} | {1} | {2,6:#,##0.0} ms (+/- {3:#0.0})", idx, histo.GetDistribution(1, 5000 - 1), histo.Median, histo.MedianAbsoluteDeviation())); if (idx % 30 == 29) { Console.WriteLine(this.TimeLine.MergeResults().GetReport(true)); return(true); } return(false); } ); }
public MessageQueueRunner(string id, AgentRole role, TimeSpan delayMin, TimeSpan delayMax) { this.Id = id; this.Role = role; this.DelayMin = delayMin; this.DelayMax = delayMax; this.TimeLine = new RobustTimeLine( TimeSpan.FromSeconds(5), onCompleted: (histo, idx) => { Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0,3} | {1} | {2,6:#,##0.0} ms (+/- {3:#0.0})", idx, histo.GetDistribution(1, 5000 - 1), histo.Median, histo.MedianAbsoluteDeviation())); if (idx % 30 == 29) { Console.WriteLine(this.TimeLine.MergeResults().GetReport(true)); return true; } return false; } ); }
private async Task <AgentRole[]> SetAgentRoleCode(long agentId, AgentRole[] requestedAgentRoles) { if (requestedAgentRoles == null || requestedAgentRoles.Length == 0) { return(null); } var getAgentResp = await _client.GetAgentAsync(new GetAgentRequest { ContractVersion = _navApiContractVer, MessageContractVersion = _navMsgContractVer, Signature = await _sessionBag.Signature(), EnableExceptionStackTrace = false, GetAgentReqData = new GetAgentRequestData { GetAgentBy = nskCommonEnum.GetAgentBy.AgentID, AgentID = agentId, GetDetails = true } }); var requestedAgentRoleCode = requestedAgentRoles[0].RoleCode; if (getAgentResp.Agent.AgentRoles.ToList().Exists(p => p.RoleCode == requestedAgentRoleCode)) { // no role change return(null); } var updatedRoles = new AgentRole[getAgentResp.Agent.AgentRoles.Length + 1]; // delete currently assigned roles for (var i = 0; i < getAgentResp.Agent.AgentRoles.Length; i++) { var role = getAgentResp.Agent.AgentRoles[i]; role.State = nskCommonEnum.MessageState.Deleted; updatedRoles[i] = role; } // assign new role requested updatedRoles[updatedRoles.Length - 1] = GetNewRole(requestedAgentRoleCode)[0]; return(updatedRoles); }
public void Stop(int aimFloor, int currentAgentFloor, AgentRole role) { elevatorStatus = ElevatorStatus.Stopped; CurrentFloor = currentAgentFloor; if (currentAgentFloor != aimFloor) { currentAgentFloor = aimFloor; Elevate(aimFloor, currentAgentFloor, role); return; } if (CanGetOffElevator(aimFloor, role)) { CanOpen = true; } else { Console.WriteLine($"Agent with {role} role can't get off on this floor - {aimFloor + 1}"); CanOpen = false; } }
public async Task <ActionResult> RoleForCreate([Bind(Include = "RoleName, Description")] RoleViewModel model) { if (ModelState.IsValid) { if (await RoleManager.RoleExistsAsync(model.RoleName)) { ModelState.AddModelError("", "权限名已被使用"); } else { var role = new AgentRole(model.RoleName, model.Description); var res = await RoleManager.CreateAsync(role); if (res.Succeeded) { return(RedirectToAction("Role", "Agent")); } AddErrors(res); } } return(View()); }
/// <summary> /// Add the agent to the existing collection of agents using only the specified role and name. /// </summary> /// <param name="role"></param> /// <param name="name"></param> public void AddAgent(AgentRole role, string name) { // Create empty instances of the static and dynamic parts of the agent. AgentStateStatic newAgentStateStatic = new AgentStateStatic(); AgentStateDynamic newAgentStateDynamic = new AgentStateDynamic(); // Assign the role and name of the static part. newAgentStateStatic.AssignRole(role); newAgentStateStatic.SetName(name); // We give the dynamic part a link to the static part. newAgentStateDynamic.SetAgentInfo(newAgentStateStatic); // We combine both parts into one and add to the collection. agents.Add(newAgentStateStatic, newAgentStateDynamic); // Очистка newAgentStateStatic = null; newAgentStateDynamic = null; GC.Collect(); UpdateHashCode(); }
/// <summary> /// This method creates a separate agent using the information passed to it. /// Then it places the agent on the environment and passes information about it to it. /// </summary> public void CreateAgent(string name, bool status, AgentRole role, Goal goals, WorldContext beliefs, string spawnLocationName) { // We clone locations from the world. Dictionary <LocationStatic, LocationDynamic> locations = currentStoryState.CloneLocations(); // We construct a new agent, from static and dynamic parts. AgentStateStatic newAgentStateStatic = new AgentStateStatic(name, role); AgentStateDynamic newAgentStateDynamic = new AgentStateDynamic(status, goals, beliefs, newAgentStateStatic); KeyValuePair <AgentStateStatic, AgentStateDynamic> newAgent = new KeyValuePair <AgentStateStatic, AgentStateDynamic>(newAgentStateStatic, newAgentStateDynamic); // Add the agent to the list of agents. currentStoryState.AddAgent(newAgent, currentStoryState.GetLocationByName(spawnLocationName)); // We transfer information about the locations in the world to the agent. newAgent.Value.GetBeliefs().SetLocationsInWorld(locations); // We inform the agent in which location it was created. newAgent.Value.GetBeliefs().SetMyLocation(newAgent.Value.GetBeliefs().GetLocationByName(spawnLocationName)); newAgent.Value.GetBeliefs().AddAgentInBeliefs(newAgent, newAgent.Key.GetRole()); newAgent.Value.GetBeliefs().GetAgentByName(newAgent.Key.GetName()). SetLocation(newAgent.Value.GetBeliefs().GetLocationByName(spawnLocationName)); }
private static AgentRoleInfo ToAgentRoleInfo(AgentRole agentRole) => new ()
public void JoinBlueTeam(AgentRole role) { agentRole = role; team = Team.blue; agentRenderer.material = academy.blueMaterial; }
public void AssignRole(AgentRole role) { this.role = role; }