// ------------------------------------------------------------------- // Initialization public virtual void Initialize(NavSection navSection, NavConnection destination) { m_CurrentNavSection = navSection; RegisterVehicle(m_CurrentNavSection, true); m_CurrentOutConnection = destination; agent.enabled = true; speed = TrafficSystem.Instance.GetAgentSpeedFromKPH(Mathf.Min(navSection.speedLimit, maxSpeed)); agent.speed = speed; agent.destination = destination.transform.position; }
// ------------------------------------------------------------------- // Switch Road private void SwitchRoad(NavConnection newConnection) { RegisterVehicle(m_CurrentNavSection, false); speed = TrafficSystem.Instance.GetAgentSpeedFromKPH(Mathf.Min(newConnection.navSection.speedLimit, maxSpeed)); agent.speed = speed; m_CurrentNavSection = newConnection.navSection; RegisterVehicle(m_CurrentNavSection, true); m_CurrentOutConnection = newConnection.GetOutConnection(); if (m_CurrentOutConnection != null) { agent.destination = m_CurrentOutConnection.transform.position; } }
public static string Get(NavSection section, string node = null) { var sb = new StringBuilder(); sb.AppendFormat("GETSETCODE / {0}", ControllerHelper.Text(section)); if (!string.IsNullOrEmpty(node)) { sb.AppendFormat(" / {0}", node); } return(sb.ToString()); }
public static string Get(NavSection section, string node = null) { var sb = new StringBuilder(); sb.AppendFormat("GETSETCODE / {0}", ControllerHelper.Text(section)); if (!string.IsNullOrEmpty(node)) { sb.AppendFormat(" / {0}", node); } return sb.ToString(); }
/// <summary> /// Creates the section. /// </summary> /// <param name="parent">The parent.</param> /// <param name="solution">The solution.</param> /// <param name="name">The name.</param> /// <param name="isAppTab">if set to <c>true</c> [is app tab].</param> /// <returns></returns> private static NavSection CreateSection(NavContainer parent, Solution solution, string name, bool isAppTab) { var section = new NavSection(); if (solution != null) { section.InSolution = solution; } section.Name = name; section.ResourceInFolder.Add(parent); section.IsAppTab = isAppTab; return(section); }
public static string Text(NavSection section) { switch (section) { case NavSection.CV: return "CV"; case NavSection.Contact: return "Contact"; case NavSection.Home: return "Home"; case NavSection.Portfolio: return "Portfolio"; case NavSection.Skills: return "Skills"; case NavSection.Testimonials: return "Testimonials"; case NavSection.Blog: return "Blog"; default: throw new Exception("Unhandled navigation route"); } }
public virtual void Initialize(NavSection navSection, NavConnection destination) { m_CurrentNavSection = navSection; RegisterVehicle(m_CurrentNavSection, true); m_CurrentOutConnection = destination; agent.enabled = true; speed = TrafficSystem.Instance.GetAgentSpeedFromKPH(Mathf.Min(navSection.speedLimit, maxSpeed)); agent.speed = speed; agent.destination = destination.transform.position; mqttClient = new MqttClient("35.193.52.170"); mqttClient.Connect(System.Guid.NewGuid().ToString()); agentMessage = gameObject.AddComponent <AgentMessage>(); time = 0.0f; publishesPerSecond = 1.0f; }
public static string Text(NavSection section) { switch (section) { case NavSection.CV: return("CV"); case NavSection.Contact: return("Contact"); case NavSection.Home: return("Home"); case NavSection.Portfolio: return("Portfolio"); case NavSection.Skills: return("Skills"); case NavSection.Testimonials: return("Testimonials"); case NavSection.Blog: return("Blog"); default: throw new Exception("Unhandled navigation route"); } }
public virtual void RegisterVehicle(NavSection section, bool isAdd) { section.RegisterVehicle(this, isAdd); }
public static MvcHtmlString MainNavListItem(this HtmlHelper html, NavSection thisSection, NavSection activeSection, string linkClass = null) { return MvcHtmlString.Create(string.Format("<li class=\"{0}\">{1}</li>", activeSection == thisSection ? "active" : "", html.ActionLink(ControllerHelper.Text(thisSection), "Index", ControllerHelper.Controller(thisSection), null, new { title = ControllerHelper.Controller(thisSection), @class = linkClass }))); }
/// <summary> /// Upgrades the top menu navigation sections. /// </summary> /// <param name="topMenu">The top menu.</param> private static void UpgradeTopMenuNavSections(TopMenu topMenu) { NavSection appTabNavSection = null; var resourcesToMove = new List <Resource>(); bool saveAppTab = false; if (topMenu.FolderContents == null) { return; } // Get all the immediate children of the top menu foreach (Resource resource in topMenu.FolderContents) { bool isAppTab = false; var navSection = resource.As <NavSection>(); if (navSection != null && ((navSection.IsAppTab ?? false) || navSection.Name == topMenu.Name)) { isAppTab = true; } if (!isAppTab) { resourcesToMove.Add(resource); } else { if (appTabNavSection == null) { appTabNavSection = navSection.AsWritable <NavSection>(); } } } if (resourcesToMove.Count > 0) { // Clear the existing top menu items var topMenuWritable = topMenu.AsWritable <TopMenu>(); var folderContents = topMenuWritable.FolderContents; folderContents.RemoveRange(resourcesToMove); topMenuWritable.FolderContents = folderContents; topMenuWritable.Save(); } if (appTabNavSection == null) { // Create a new app tab as a child of the top menu appTabNavSection = CreateSection(topMenu.As <NavContainer>(), topMenu.InSolution, topMenu.Name, true); appTabNavSection.Name = topMenu.Name; saveAppTab = true; } if (resourcesToMove.Count > 0) { var folderContents = appTabNavSection.FolderContents; folderContents.AddRange(resourcesToMove); appTabNavSection.FolderContents = folderContents; saveAppTab = true; } if (saveAppTab) { appTabNavSection.Save(); } }
public static MvcHtmlString SiteHeader(this HtmlHelper html, NavSection section) { return html.Partial("SiteHeader", section); }
public static MvcHtmlString MainNavListItem(this HtmlHelper html, NavSection thisSection, NavSection activeSection, string linkClass = null) { return(MvcHtmlString.Create(string.Format("<li class=\"{0}\">{1}</li>", activeSection == thisSection ? "active" : "", html.ActionLink(ControllerHelper.Text(thisSection), "Index", ControllerHelper.Controller(thisSection), null, new { title = ControllerHelper.Controller(thisSection), @class = linkClass })))); }
public static MvcHtmlString SiteHeader(this HtmlHelper html, NavSection section) { return(html.Partial("SiteHeader", section)); }