private bool MatchesType(EntityTypesEnum entityTypesEnum, EntityType entityType) { // General Type level checks switch (entityTypesEnum) { case EntityTypesEnum.EntityType: return(true); case EntityTypesEnum.AgentType: if (entityType is AgentType) { return(true); } break; case EntityTypesEnum.WorldObjectType: if (entityType is WorldObjectType) { return(true); } break; case EntityTypesEnum.AgentEventType: if (entityType is AgentEventType) { return(true); } break; } return(false); }
public override List <EntityInfo> GetKnownEntities(Agent agent, EntityTypesEnum entityTypesEnum, float radius, bool detectInventory) { List <EntityInfo> results = new List <EntityInfo>(); if (radius <= 0) { foreach (EntityInfo entityKnowledgeInfo in knownEntities[agent].Values) { if (MatchesType(entityTypesEnum, entityKnowledgeInfo.entity.entityType) && (detectInventory || entityKnowledgeInfo.entity.inEntityInventory == null)) { results.Add(entityKnowledgeInfo); } } } else { foreach (EntityInfo entityKnowledgeInfo in knownEntities[agent].Values) { if (MatchesType(entityTypesEnum, entityKnowledgeInfo.entity.entityType) && (detectInventory || entityKnowledgeInfo.entity.inEntityInventory == null) && Vector3.Distance(entityKnowledgeInfo.lastPos, agent.transform.position) < radius) { results.Add(entityKnowledgeInfo); } } } return(results); }
public async Task CreateAsync(IAccount entity, EntityTypesEnum createdEntityTypeId, int?createdById = null) { using var connection = _connectionFactory.GetConnection(); string sqlQuery = "INSERT INTO Accounts (Email, Password, CreateDate) Values(@Email, @Password, @CreateDate)"; int rowsAffected = connection.Execute(sqlQuery, entity); if (rowsAffected != 1) { throw new ArgumentException("AccountRepository.AddAsync.NoRowsAffected"); } }
private Tile tileEntityFactory(EntityTypesEnum type) { Tile newTileEntity = null; switch (type) { case EntityTypesEnum.Tile: newTileEntity = new Tile(); break; case EntityTypesEnum.SteelWall: new SteelWall(out newTileEntity); break; case EntityTypesEnum.Exit: new Exit(out newTileEntity); break; case EntityTypesEnum.Wall: new Wall(out newTileEntity); break; case EntityTypesEnum.Mud: new Mud(out newTileEntity); break; case EntityTypesEnum.Boulder: new Boulder(out newTileEntity); break; case EntityTypesEnum.Diamond: new Diamond(out newTileEntity); break; case EntityTypesEnum.Rockford: Rockford rf = new Rockford(out newTileEntity); rockfordPos = rf; break; case EntityTypesEnum.Firefly: new FireFly(out newTileEntity); break; } if (newTileEntity == null) { throw new Exception(); } else { return(newTileEntity); } }
private void findTypeAndPrint(Tile tile) { EntityTypesEnum printingType = tile.getEntityType(); switch (printingType) { case EntityTypesEnum.Tile: Console.Write(" "); break; case EntityTypesEnum.SteelWall: printSteelWall(tile); break; case EntityTypesEnum.Exit: Console.Write("E"); break; case EntityTypesEnum.Wall: Console.Write("="); break; case EntityTypesEnum.Mud: Console.Write("▒"); break; case EntityTypesEnum.Boulder: Console.Write("B"); break; case EntityTypesEnum.Diamond: Console.Write("¤"); break; case EntityTypesEnum.Rockford: Console.Write("©"); break; case EntityTypesEnum.Firefly: Console.Write("F"); break; } }
public async Task DeleteAsync(IUser entity, EntityTypesEnum deletedEntityTypeId, int?deletedById = null) { throw new System.NotImplementedException(); }
public abstract List <EntityInfo> GetKnownEntities(Agent agent, EntityTypesEnum entityTypesEnum, float radius = -1, bool detectInventory = false);
public async Task DeleteAsync(IAccount entity, EntityTypesEnum deletedEntityTypeId, int?deletedById = null) { throw new NotImplementedException(); }
public async Task CreateAsync(IAccount entity, EntityTypesEnum createdEntityTypeId, int?createdById = null) { _context.Accounts.Add((Account)entity); }
public async Task UpdateAsync(IUser entity, EntityTypesEnum updatedEntityTypeId, int?updatedById = null) { throw new NotImplementedException(); }
public async Task CreateAsync(IUser entity, EntityTypesEnum createdEntityTypeId, int?createdById = null) { _context.Users.Add((User)entity); }