public ActionResult DeleteConfirmed(int id)
        {
            AgentLocation agentLocation = db.AgentLocations.Find(id);

            db.AgentLocations.Remove(agentLocation);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 /// <summary>
 /// Callback: a Geeo agent just entered the current user view.
 /// </summary>
 /// <param name="agent">The actual agent.</param>
 private void Geeo_OnAgentEntered(Agent agent)
 {
     // If the agent doesn't exist in the agents list and is not the current user, add it then display it
     if ((agent.id != lastUserLocation.id) && !agentsLocations.ContainsKey(agent.id))
     {
         AgentLocation agentLocation = new AgentLocation(agent.id, agent.latitude, agent.longitude, agentLocationDisplayPointPrefab, displayMap.transform);
         agentsLocations.Add(agent.id, agentLocation);
         DisplayAgentLocation(agentLocation, true);
     }
 }
 public ActionResult Edit([Bind(Include = "Id,AssignLocation,AgentId")] AgentLocation agentLocation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(agentLocation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AgentId = new SelectList(db.DeliveryAgents, "Id", "AgentName", agentLocation.AgentId);
     return(View(agentLocation));
 }
예제 #4
0
 /// <summary>
 /// Callback: a Geeo agent just moved in the current user view.
 /// </summary>
 /// <param name="agent">The actual agent.</param>
 private void Geeo_OnAgentMoved(Agent agent)
 {
     // If the agent exists in the agents list, update its data then display it
     if (agentsLocations.ContainsKey(agent.id))
     {
         AgentLocation agentLocation = agentsLocations[agent.id];
         agentLocation.latitude  = agent.latitude;
         agentLocation.longitude = agent.longitude;
         DisplayAgentLocation(agentLocation, true);
     }
 }
예제 #5
0
 /// <summary>
 /// Callback: a Geeo agent just left the current user view.
 /// </summary>
 /// <param name="agent">The actual agent.</param>
 private void Geeo_OnAgentLeft(Agent agent)
 {
     // If the agent exists in the agents list, remove it from the list and hide/destroy it
     if (agentsLocations.ContainsKey(agent.id))
     {
         AgentLocation agentLocation = agentsLocations[agent.id];
         agentsLocations.Remove(agent.id);
         DisplayAgentLocation(agentLocation, false);
         Destroy(agentLocation.displayPoint);
     }
 }
        public ActionResult Create([Bind(Include = "Id,AssignLocation,AgentId")] AgentLocation agentLocation)
        {
            if (ModelState.IsValid)
            {
                db.AgentLocations.Add(agentLocation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AgentId = new SelectList(db.DeliveryAgents, "Id", "AgentName", agentLocation.AgentId);
            return(View(agentLocation));
        }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AgentLocation agentLocation = db.AgentLocations.Find(id);

            if (agentLocation == null)
            {
                return(HttpNotFound());
            }
            return(View(agentLocation));
        }
        // GET: AgentLocations/Edit/5

        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AgentLocation agentLocation = db.AgentLocations.Find(id);

            if (agentLocation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AgentId = new SelectList(db.DeliveryAgents, "Id", "AgentName", agentLocation.AgentId);
            return(View(agentLocation));
        }
    private void OnCollisionEnter(Collision collision)
    {
        State = AgentState.Landed;

        EventHandler <AgentLocation> handler = AgentLanded;

        AgentLocation locn = new AgentLocation();

        locn.Location = transform.position;


        //If we hit water, we landed.
        if (collision.gameObject.tag == "Water")
        {
            if (handler != null)
            {
                handler(this, locn);
            }
        }
    }
예제 #10
0
        /// <summary>
        /// Display an agent's location point.
        /// </summary>
        /// <param name="agentLocation">The agent's location to display or hide.</param>
        /// <param name="display">If the agent location should be displayed or hidden.</param>
        private void DisplayAgentLocation(AgentLocation agentLocation, bool display = true)
        {
            // If the agent location should be displayed, update its position and display it
            if (display)
            {
                // Calculate the new agent location point's position by converting GPS coordinates to X/Y ones
                float agentLocationX, agentLocationY;
                LatitudeLongitudeToXY(agentLocation.latitude, agentLocation.longitude, out agentLocationX, out agentLocationY);
                agentLocation.displayPoint.transform.position = new Vector3(agentLocationX, agentLocationY, agentLocation.displayPoint.transform.localPosition.z);

                // Show the agent location point
                if (!agentLocation.displayPoint.activeSelf)
                {
                    agentLocation.displayPoint.SetActive(true);
                }
            }
            // If the agent location should be hidden, hide it
            else if (agentLocation.displayPoint.activeSelf)
            {
                agentLocation.displayPoint.SetActive(false);
            }
        }