public static int GetAnimalTypeID(AnimalTypes animalType) { int num = 32; for (int index = 0; index < num; ++index) { if ((int)animalType >> index == 1 && animalType == (AnimalTypes)(1 << index)) { return(index); } } return(-1); }
/// <summary> /// Se encarga de identificar los animales segun el patron configurado en el setting patternbovinos /// </summary> /// <param name="Types">tipo del animal</param> /// <returns>devuelve la lista de animales segun el patron configurado</returns> private List <string> IdentifyAnimals(AnimalTypes Types) { List <string> _result = new List <string>(); try { _result = Util.FindOfList(Data, (Types == AnimalTypes.Bovinos) ? Config.PatternBovinos : ""); } catch (Exception ex) { Log.WriteErrorLog($"Error al identificar el tipo de animal: {ex.Message}"); throw new Exception(ex.Message); } return(_result); }
public float GetFearOfPosition(AnimalTypes type, Vector3 position) { float maximumFear = 0f; for (int i = 0; i < animals.Count; i++) { float effectiveFear = AnimalRelationships.Instance.GetOpinionOf(type, animals[i].type).fear; effectiveFear = Attenuate(effectiveFear, (animals[i].GetPosition() - position).magnitude); if (maximumFear < effectiveFear) { maximumFear = effectiveFear; } } return(maximumFear); }
public void Can_find_animal_by_userId_and_AnimalName() { //arrange const string animalName = "Tom"; const string userId = "*****@*****.**"; const AnimalTypes type = AnimalTypes.Cat; var repository = new InMemoryAnimalRepository(AnimalDataUtilities.AnimalData(userId)); var service = new VirtualPet.Services.AnimalFindService(repository); //act var returnedAnimal = service.GetByIdentifier(new AnimalIdentifier(userId, animalName)); //assert returnedAnimal.Name.Should().Be(animalName); returnedAnimal.Owner.Should().Be(userId); returnedAnimal.Type.Should().Be(type); }
public AnimalInfo( AnimalTypes _animalType, BreedingTypes _breedingType, string _name, string _identifierName, int _animalID, int _chunkID, AnimalModelInfo _modelInfo) { this.AnimalType = _animalType; this.BreedingType = _breedingType; this.Name = _name; this.IdentifierName = _identifierName; this.AnimalID = _animalID; this.ModelInfo = _modelInfo; }
AnimalTypes EvolvedType(AnimalTypes inType) { switch (inType) { case AnimalTypes.FISH: return(AnimalTypes.WHALE); break; case AnimalTypes.RABBIT: return(AnimalTypes.SHEEP); break; case AnimalTypes.DUCK: return(AnimalTypes.WHALE); break; case AnimalTypes.DOG: return(AnimalTypes.ELEPHANT); break; case AnimalTypes.WHALE: return(AnimalTypes.BEE); break; case AnimalTypes.ELEPHANT: return(AnimalTypes.BEE); break; case AnimalTypes.BEE: return(AnimalTypes.DUCK); break; case AnimalTypes.SHEEP: return(AnimalTypes.DOG); break; } return(AnimalTypes.FISH); }
private void AddAnimalTypesToView() { try { List <SelectListItem> animalTypeItems = new List <SelectListItem>(); foreach (string type in AnimalTypes.ToList()) { animalTypeItems.Add(new SelectListItem(type, type)); } ViewData.Add("AnimalTypes", animalTypeItems); } catch (Exception e) { Debug.WriteLine(e); } }
public async Task Can_get_pet_by_owner_email_and_name() { //arrange const string expectedOwner = "*****@*****.**"; const string expectedName = "fred"; const AnimalTypes expectedType = AnimalTypes.Cat; //act var response = await _client.GetAsync("/api/animal/jayconnerghost%40gmail.com/fred"); response.EnsureSuccessStatusCode(); var responseString = await response.Content.ReadAsStringAsync(); //assert var animals = JsonConvert.DeserializeObject <Animal>(responseString); animals.Name.Should().Be(expectedName); animals.Owner.Should().Be(expectedOwner); animals.Type.Should().Be(expectedType); }
public void Can_retrieve_a_animal() { //arrange const string animalName = "Tom"; const string owner = "*****@*****.**"; const AnimalTypes type = AnimalTypes.Cat; var repository = new InMemoryAnimalRepository(AnimalDataUtilities.AnimalData(owner)); var service = new AnimalFindService(repository); var controller = new AnimalController(service); //act var animal = controller.Get(owner, animalName); //Assert animal.Name.Should().Be(animalName); animal.Owner.Should().Be(owner); animal.Type.Should().Be(type); }
public bool AddAnimal(string name, GrootteTypes size, AnimalTypes type) { Animal animal = new Animal(name, size, type); Animals.Add(animal); //Hier wordt bij elke wagon gecontroleerd of animal toegevoegd kan worden foreach (Wagon wagon in Wagons) { if (wagon.AddToWagon(animal)) { return(true); } } //Als er geen animal toegevoegd kan worden ga naar AnimalToNewWagon methode if (animal.AnimalAdded) { return(false); } AnimalToNewWagon(animal); return(false); }
public bool SavePrice(AnimalTypes dto) { try { using (var sql = SugarDbContext.GetInstance()) { if (dto.animalTypeId == 0) { sql.Insertable(dto).ExecuteCommand(); } else { sql.Updateable(dto).ExecuteCommand(); } } return(true); } catch (Exception ex) { LogNHelper.Exception(ex); } return(false); }
// Use this for initialization void Start() { s_this = this; gameState = GameStates.GOTO_ENV; InstructionList = new Dictionary <GameStates, string>(); InstructionList.Add(GameStates.GOTO_ENV, "Goto where the animal might be found."); InstructionList.Add(GameStates.GET_TRAP, "Go and get the right type of trap."); InstructionList.Add(GameStates.BAIT_TRAP, "Place the trap and bait it."); InstructionList.Add(GameStates.CAPTURE_ANIMAL, "Trigger the trap when the animal is close."); InstructionList.Add(GameStates.WIN, "Well done - you got the correct animal."); Clue1List = new Dictionary <AnimalTypes, string>(); Clue1List.Add(AnimalTypes.ANIMAL_PORPOISE, "I like the water."); Clue1List.Add(AnimalTypes.ANIMAL_RABBIT, "Give me space to roam."); Clue1List.Add(AnimalTypes.ANIMAL_BADGER, "Give me space to roam."); Clue1List.Add(AnimalTypes.ANIMAL_PONY, "Give me space to roam."); Clue1List.Add(AnimalTypes.ANIMAL_SALMON, "I like the water."); Clue1List.Add(AnimalTypes.ANIMAL_GOOSE, "I like the water."); Clue1List.Add(AnimalTypes.ANIMAL_HERON, "I like the water."); Clue1List.Add(AnimalTypes.ANIMAL_WOMBAT, "Give me space to roam."); Clue2List = new Dictionary <AnimalTypes, string>(); Clue2List.Add(AnimalTypes.ANIMAL_PORPOISE, "Swim, swim, swim."); Clue2List.Add(AnimalTypes.ANIMAL_RABBIT, "Give me space!."); Clue2List.Add(AnimalTypes.ANIMAL_BADGER, "I like to sleep with a roof over my head."); Clue2List.Add(AnimalTypes.ANIMAL_PONY, "Give me space!."); Clue2List.Add(AnimalTypes.ANIMAL_SALMON, "Swim, swim, swim."); Clue2List.Add(AnimalTypes.ANIMAL_GOOSE, "On and over, but not under."); Clue2List.Add(AnimalTypes.ANIMAL_HERON, "On and over, but not under."); Clue2List.Add(AnimalTypes.ANIMAL_WOMBAT, "I like to sleep with a roof over my head."); Clue3List = new Dictionary <AnimalTypes, string>(); Clue3List.Add(AnimalTypes.ANIMAL_PORPOISE, "Always happy, always smiling."); Clue3List.Add(AnimalTypes.ANIMAL_RABBIT, "Big ears, big everything."); Clue3List.Add(AnimalTypes.ANIMAL_BADGER, "Black and white and underground."); Clue3List.Add(AnimalTypes.ANIMAL_PONY, "I'm a miniature powerhouse."); Clue3List.Add(AnimalTypes.ANIMAL_SALMON, "I travel home to have children."); Clue3List.Add(AnimalTypes.ANIMAL_GOOSE, "Honk!"); Clue3List.Add(AnimalTypes.ANIMAL_HERON, "Strutting in the shallows."); Clue3List.Add(AnimalTypes.ANIMAL_WOMBAT, "G'day mate!"); AnimalEnviroments = new Dictionary <AnimalTypes, Enviroments>(); AnimalEnviroments.Add(AnimalTypes.ANIMAL_PORPOISE, Enviroments.ENVIROMENT_LAKE); AnimalEnviroments.Add(AnimalTypes.ANIMAL_RABBIT, Enviroments.ENVIROMENT_FIELD); AnimalEnviroments.Add(AnimalTypes.ANIMAL_BADGER, Enviroments.ENVIROMENT_FIELD); AnimalEnviroments.Add(AnimalTypes.ANIMAL_PONY, Enviroments.ENVIROMENT_FIELD); AnimalEnviroments.Add(AnimalTypes.ANIMAL_SALMON, Enviroments.ENVIROMENT_LAKE); AnimalEnviroments.Add(AnimalTypes.ANIMAL_GOOSE, Enviroments.ENVIROMENT_LAKE); AnimalEnviroments.Add(AnimalTypes.ANIMAL_HERON, Enviroments.ENVIROMENT_LAKE); AnimalEnviroments.Add(AnimalTypes.ANIMAL_WOMBAT, Enviroments.ENVIROMENT_FIELD); AnimalTrapTypes = new Dictionary <AnimalTypes, TrapType>(); AnimalTrapTypes.Add(AnimalTypes.ANIMAL_PORPOISE, TrapType.TRAPTYPE_UNDERSURFACE); AnimalTrapTypes.Add(AnimalTypes.ANIMAL_RABBIT, TrapType.TRAPTYPE_SURFACE); AnimalTrapTypes.Add(AnimalTypes.ANIMAL_BADGER, TrapType.TRAPTYPE_UNDERSURFACE); AnimalTrapTypes.Add(AnimalTypes.ANIMAL_PONY, TrapType.TRAPTYPE_SURFACE); AnimalTrapTypes.Add(AnimalTypes.ANIMAL_SALMON, TrapType.TRAPTYPE_UNDERSURFACE); AnimalTrapTypes.Add(AnimalTypes.ANIMAL_GOOSE, TrapType.TRAPTYPE_SURFACE); AnimalTrapTypes.Add(AnimalTypes.ANIMAL_HERON, TrapType.TRAPTYPE_SURFACE); AnimalTrapTypes.Add(AnimalTypes.ANIMAL_WOMBAT, TrapType.TRAPTYPE_UNDERSURFACE); AnimalBaitTypes = new Dictionary <AnimalTypes, BaitTypes>(); AnimalBaitTypes.Add(AnimalTypes.ANIMAL_PORPOISE, BaitTypes.PORPOSISE_BAIT); AnimalBaitTypes.Add(AnimalTypes.ANIMAL_RABBIT, BaitTypes.RABBIT_BAIT); AnimalBaitTypes.Add(AnimalTypes.ANIMAL_BADGER, BaitTypes.BADGER_BAIT); AnimalBaitTypes.Add(AnimalTypes.ANIMAL_PONY, BaitTypes.PONY_BAIT); AnimalBaitTypes.Add(AnimalTypes.ANIMAL_SALMON, BaitTypes.SALMON_BAIT); AnimalBaitTypes.Add(AnimalTypes.ANIMAL_GOOSE, BaitTypes.GOOSE_BAIT); AnimalBaitTypes.Add(AnimalTypes.ANIMAL_HERON, BaitTypes.HERON_BAIT); AnimalBaitTypes.Add(AnimalTypes.ANIMAL_WOMBAT, BaitTypes.WOMBAT_BAIT); BaitForEachTrap = new Dictionary <KeyValuePair <TrapType, Enviroments>, List <BaitTypes> >(); BaitForEachTrap.Add(new KeyValuePair <TrapType, Enviroments>(TrapType.TRAPTYPE_SURFACE, Enviroments.ENVIROMENT_FIELD), new List <BaitTypes>() { BaitTypes.PONY_BAIT, BaitTypes.RABBIT_BAIT }); BaitForEachTrap.Add(new KeyValuePair <TrapType, Enviroments>(TrapType.TRAPTYPE_UNDERSURFACE, Enviroments.ENVIROMENT_FIELD), new List <BaitTypes>() { BaitTypes.BADGER_BAIT, BaitTypes.WOMBAT_BAIT }); BaitForEachTrap.Add(new KeyValuePair <TrapType, Enviroments>(TrapType.TRAPTYPE_SURFACE, Enviroments.ENVIROMENT_LAKE), new List <BaitTypes>() { BaitTypes.HERON_BAIT, BaitTypes.GOOSE_BAIT }); BaitForEachTrap.Add(new KeyValuePair <TrapType, Enviroments>(TrapType.TRAPTYPE_UNDERSURFACE, Enviroments.ENVIROMENT_LAKE), new List <BaitTypes>() { BaitTypes.PORPOSISE_BAIT, BaitTypes.SALMON_BAIT }); targetAnimal = (AnimalTypes)Random.Range(0, (int)AnimalTypes.NUM_ANIMALS); EnvTriggerToUse = EnvTriggers[(int)AnimalEnviroments[targetAnimal]]; wantedTrapType = AnimalTrapTypes[targetAnimal]; neededBaitType = AnimalBaitTypes[targetAnimal]; }
public AnimalAttribute(AnimalTypes type = (AnimalTypes) ~0) { this.type = type; }
public PriceEditForm(AnimalTypes dto) { InitializeComponent(); _animalModel = dto; }
public Animal(AnimalTypes animalType) { Type = animalType; }
public Animal(string name, GrootteTypes size, AnimalTypes type) { this._Naam = name; this.grootteType = size; this.animalType = type; }
public abstract IAnimal GetAnimal(AnimalTypes animalType);
public AnimalCard(AnimalTypes type) { Type = type; }
public override string ToString() => JsonConvert.SerializeObject(new { AnimalTypes = AnimalTypes.OrderBy(i => i), TraitValues = TraitValues.OrderBy(i => i.Key).ToDictionary(i => i, i => i.Value.OrderBy(j => j)), BooleanTraits = BooleanTraits.OrderBy(i => i) });
public AnimalDef(AnimalTypes animalType, ColorTypes colour) { m_animalType = animalType; m_colour = colour; }
private void DesireTableSetting() { AnimalTypes animalType = this.AnimalType; BreedingTypes breedingType = this.BreedingType; this.ClearTable(); foreach (DesireType desireTypeElement in AnimalDesireController.DesireTypeElements) { this.ParamTable[desireTypeElement] = 0.0f; } Dictionary <BreedingTypes, Dictionary <int, DesireType> > dictionary1; Dictionary <int, DesireType> dictionary2; if (this.AnimalTable.DesirePriorityTable.TryGetValue(animalType, out dictionary1) && dictionary1.TryGetValue(breedingType, out dictionary2)) { foreach (KeyValuePair <int, DesireType> keyValuePair in dictionary2) { this.PriorityTable[keyValuePair.Key] = keyValuePair.Value; this.PriorityList.Add(keyValuePair.Key); } this.PriorityList.Sort(); } Dictionary <BreedingTypes, Dictionary <DesireType, int> > dictionary3; Dictionary <DesireType, int> dictionary4; if (this.AnimalTable.DesireSpanTable.TryGetValue(animalType, out dictionary3) && dictionary3.TryGetValue(breedingType, out dictionary4)) { foreach (KeyValuePair <DesireType, int> keyValuePair in dictionary4) { this.SpanTable[keyValuePair.Key] = keyValuePair.Value; } } Dictionary <BreedingTypes, Dictionary <DesireType, Tuple <float, float> > > dictionary5; Dictionary <DesireType, Tuple <float, float> > dictionary6; if (this.AnimalTable.DesireBorderTable.TryGetValue(animalType, out dictionary5) && dictionary5.TryGetValue(breedingType, out dictionary6)) { foreach (KeyValuePair <DesireType, Tuple <float, float> > keyValuePair in dictionary6) { this.BorderTable[keyValuePair.Key] = keyValuePair.Value; } } Dictionary <BreedingTypes, Dictionary <AnimalState, Dictionary <DesireType, float> > > dictionary7; Dictionary <AnimalState, Dictionary <DesireType, float> > dictionary8; if (this.AnimalTable.DesireRateTable.TryGetValue(animalType, out dictionary7) && dictionary7.TryGetValue(breedingType, out dictionary8)) { foreach (KeyValuePair <AnimalState, Dictionary <DesireType, float> > keyValuePair1 in dictionary8) { this.RateTable[keyValuePair1.Key] = new Dictionary <DesireType, float>(); foreach (KeyValuePair <DesireType, float> keyValuePair2 in keyValuePair1.Value) { this.RateTable[keyValuePair1.Key][keyValuePair2.Key] = keyValuePair2.Value; } } } Dictionary <BreedingTypes, Dictionary <DesireType, List <AnimalState> > > dictionary9; Dictionary <DesireType, List <AnimalState> > dictionary10; if (this.AnimalTable.DesireTargetStateTable.TryGetValue(animalType, out dictionary9) && dictionary9.TryGetValue(breedingType, out dictionary10)) { foreach (KeyValuePair <DesireType, List <AnimalState> > keyValuePair in dictionary10) { List <AnimalState> animalStateList = new List <AnimalState>(); foreach (AnimalState animalState in keyValuePair.Value) { animalStateList.Add(animalState); } this.TargetStateTable[keyValuePair.Key] = animalStateList; } } Dictionary <BreedingTypes, Dictionary <DesireType, Dictionary <bool, Dictionary <DesireType, ChangeParamState> > > > dictionary11; Dictionary <DesireType, Dictionary <bool, Dictionary <DesireType, ChangeParamState> > > dictionary12; if (!this.AnimalTable.DesireResultTable.TryGetValue(animalType, out dictionary11) || !dictionary11.TryGetValue(breedingType, out dictionary12)) { return; } foreach (KeyValuePair <DesireType, Dictionary <bool, Dictionary <DesireType, ChangeParamState> > > keyValuePair1 in dictionary12) { this.ResultTable[keyValuePair1.Key] = new Dictionary <bool, Dictionary <DesireType, ChangeParamState> >(); foreach (KeyValuePair <bool, Dictionary <DesireType, ChangeParamState> > keyValuePair2 in keyValuePair1.Value) { this.ResultTable[keyValuePair1.Key][keyValuePair2.Key] = new Dictionary <DesireType, ChangeParamState>(); foreach (KeyValuePair <DesireType, ChangeParamState> keyValuePair3 in keyValuePair2.Value) { this.ResultTable[keyValuePair1.Key][keyValuePair2.Key][keyValuePair3.Key] = keyValuePair3.Value; } } } }
public ActionResult Action(AnimalTypes at) { return(View()); }
public Animal(string name, AnimalTypes type) { Name = name; Type = type; }