private void CreateCollisionArea(float x, float z, int index)
        {
            ComponentType[] components = GenericInformation.GetGenericComponents();
            components = GenericInformation.AddComponents(components, new ComponentType[]
            {
                typeof(CollisionAreaTag)
            });

            Entity entity = entityManager.CreateEntity(entityManager.CreateArchetype(components));

            entityManager.SetComponentData <CollisionAreaTag>(entity, new CollisionAreaTag
            {
                AgentIndex = index
            });

            entityManager.SetComponentData <Translation>(entity, new Translation
            {
                Value = new float3(x, 0.02f, z)
            });

            entityManager.SetSharedComponentData <RenderMesh>(entity, new RenderMesh
            {
                mesh     = collisionAreaMesh,
                material = collisionAreaMaterial
            });

            entityManager.AddComponentData <Scale>(entity, new Scale
            {
                Value = colliderSize
            });
        }
示例#2
0
        private void SetupLightArchetype()
        {
            ComponentType[] components = GenericInformation.GetGenericComponents();
            components = GenericInformation.AddComponents(components, new ComponentType[]
            {
                typeof(Light)
            });

            agentArchetype = entityManager.CreateArchetype(components);
        }
示例#3
0
        private void SetupGridDotArchetype()
        {
            ComponentType[] components = GenericInformation.GetGenericComponents();
            components = GenericInformation.AddComponents(components, new ComponentType[]
            {
                typeof(GridDotTag),
                typeof(Speed),
                typeof(MoveForward),
                typeof(AccumulatedAgents)
            });

            gridDotArchetype = entityManager.CreateArchetype(components);
        }
        public ActionResult GenericInformation(FormCollection fc, GenericInformation obj)

        {
            try
            {
                if (obj.GenericID == 0)
                {
                    obj.GenericID = 0;
                }

                obj.GenericName = fc["genericName"].ToString();
                if (Generic.CheckGenericInformation(obj.GenericID, obj.GenericName))
                {
                    if (obj.GenericID > 0)
                    {
                        if (Generic.Save(obj))
                        {
                            ModelState.Clear();
                            TempData["Msg"] = " GenericInformation  Updated Successfully";
                            return(RedirectToAction("GenericInformation", "GenericInformation"));
                        }
                    }
                    else
                    {
                        if (Generic.Save(obj))
                        {
                            ModelState.Clear();
                            TempData["Msg"] = " GenericInformation Saved Successfully";
                            return(RedirectToAction("GenericInformation", "GenericInformation"));
                        }
                    }
                }
                else
                {
                    TempData["Msg"] = " GenericInformation Already Exist's";
                    return(RedirectToAction("GenericInformation", "GenericInformation"));
                }
                return(RedirectToAction("GenericInformation", "GenericInformation"));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("GenericInformation", "GenericInformation"));
            }
            // return RedirectToAction("GenericInformation", "GenericInformation");
        }
        public bool Save(GenericInformation obj)
        {
            Connect();
            SqlCommand cmd = new SqlCommand("IUGenericInformation", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
            cmd.Parameters.AddWithValue("@LocationID", LocationID);


            if (obj.GenericID == 0)
            {
                cmd.Parameters.AddWithValue("@GenericID", 0);
                cmd.Parameters.AddWithValue("@Mode", "Add");
            }
            else
            {
                cmd.Parameters.AddWithValue("@GenericID", obj.GenericID);
                cmd.Parameters.AddWithValue("@Mode", "Edit");
            }
            cmd.Parameters.AddWithValue("@GenericName", obj.GenericName);
            if (obj.ReferenceCode == null)
            {
                cmd.Parameters.AddWithValue("@ReferenceCode", string.Empty);
            }
            else
            {
                cmd.Parameters.AddWithValue("@ReferenceCode", obj.ReferenceCode);
            }
            cmd.Parameters.AddWithValue("@CreationID", UserID);
            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private void CreateCommunicationArea(float x, float z, int index)
        {
            ComponentType[] components = GenericInformation.GetGenericComponents();
            components = GenericInformation.AddComponents(components, new ComponentType[]
            {
                typeof(CommunicationAreaTag)
            });

            Entity entity = entityManager.CreateEntity(entityManager.CreateArchetype(components));

            entityManager.SetComponentData <CommunicationAreaTag>(entity, new CommunicationAreaTag
            {
                AgentIndex = index
            });

            entityManager.SetComponentData <Translation>(entity, new Translation
            {
                Value = new float3(x, 0.01f, z)
            });

            entityManager.SetSharedComponentData <RenderMesh>(entity, new RenderMesh
            {
                mesh     = communcationAreaMesh,
                material = communicationAreaMaterial
            });

            /// Communication distance is defined as the distance till you reach another agent.
            /// A few assumptios are made:
            /// 1. All agents have their Communication device on.
            /// 2. Communication reach is circular.
            /// From 1 and 2 we can infere that the trigger system works in a straight line from robot to robot,
            /// this means that to replicate the results in Heiko's work, we need to take into account also the
            /// size of the robots. We will assume that the communication device is located at the center of the
            /// agents, so if the distance is 3.5m between robots, then the communication area is 1.75m effectively.
            entityManager.AddComponentData <Scale>(entity, new Scale
            {
                Value = communicationDistance
            });
        }
示例#7
0
 public void Handle(GenericInformation eventToHandle)
 {
     DoWrite(ConsoleColor.White, eventToHandle.Text);
 }
示例#8
0
 public void SetGenericInformation(GenericInformation genericInformation)
 {
     this.genericInformation = genericInformation;
 }