예제 #1
0
    public GameObject FindClosestResource(ResourceType resource, Vector2 myPosition, AnimalType myType)
    {
        List<GameObject> resourceList = new List<GameObject>();
        if(resource == ResourceType.food)
            resourceList = foodList;
        if(resource == ResourceType.water)
            resourceList = waterList;

        GameObject closest = resourceList[0];
        if(myType != AnimalType.prairieDog && resourceList[0].GetComponent<StoragePointSource>())
        {
            for(int i = 0; i < resourceList.Count; i++)
            {
                if(!resourceList[i].GetComponent<StoragePointSource>())
                    closest = resourceList[i];
                    break;
            }
        }

        for (int i = 0; i < resourceList.Count; i++)
        {
            float currentDistance = Vector2.Distance(closest.transform.position, myPosition);
            float newDistance = Vector2.Distance(resourceList[i].transform.position, myPosition);
            if(newDistance < currentDistance)
            {
                if(myType == AnimalType.prairieDog || !resourceList[i].GetComponent<StoragePointSource>())
                {
                    closest = resourceList[i];
                }
            }
        }

        return closest;
    }
예제 #2
0
 public void FillPrey(AnimalModel killer, AnimalModel victim, AnimalType typeOfKiller)
 {
     _prey.KillerId     = killer.Id;
     _prey.VictimId     = victim.Id;
     _prey.TypeOfKiller = (int)typeOfKiller;
     _dataBase.InsertID(_prey);
 }
예제 #3
0
        /// <summary>
        /// The button used to add an animal to the list box.
        /// </summary>
        /// <param name="sender"> Not available.</param>
        /// <param name="e"> The parameter is not used.</param>
        private void addAnimalButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Get the selected animal type from the list box.
                AnimalType animalType = (AnimalType)this.animalTypeComboBox.SelectedItem;

                // Create an animal based on the type.
                Animal animal = AnimalFactory.CreateAnimal(animalType, "Yoooo", 17, 71, Gender.Female);

                // Make a new window with the new animal.
                AnimalWindow animalWindow = new AnimalWindow(animal);

                // If the dialog box is shown then add the animal to the list and repopulate the screen with the updated list.
                if (animalWindow.ShowDialog() == true)
                {
                    zoo.AddAnimal(animal);

                    PopulateAnimalListBox();
                }
                else
                {
                    // If the above code doesn't work, do nothing.
                }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("You must choose an animal type before you can add an animal.");
            }
        }
예제 #4
0
 public Animal(String petName, AnimalType type, Random rand)
 {
     this.petName = petName;
     this.type = type;
     this.vitality = rand.Next(10) + 1;
     this.mood = Mood.Calm;
 }
예제 #5
0
 public Animal(string name, int age, Gender sex, AnimalType type)
 {
     this.Name = name;
     this.Age = age;
     this.Sex = sex;
     this.Type = type;
 }
예제 #6
0
파일: AnimalTest.cs 프로젝트: josmase/Zoo
        public void ShouldBeOfSameType()
        {
            var type   = new AnimalType("type", 0, Diet.Carnivore);
            var animal = new Animal(type, "name", 0);

            Assert.True(animal.IsType(type));
        }
예제 #7
0
    public void AddScore(AnimalType kind)
    {
        if (kind == lastAnimalType)
        {
            multiplier *= 2f;
            AudioSource.PlayClipAtPoint(ComboClip, transform.position);
        }
        else
        {
            multiplier = 1f;
        }

        lastAnimalType = kind;
        var oldScore = score;

        score += (int)((int)kind * multiplier);

        if (score - oldScore >= 1000)
        {
            AudioSource.PlayClipAtPoint(GreatClip, transform.position);
        }
        else if (score - oldScore >= 500)
        {
            AudioSource.PlayClipAtPoint(ExcellentClip, transform.position);
        }

        ScoreText.text = score.ToString();
    }
예제 #8
0
 public Animal(string name)
 {
     this.animalType = AnimalType.Fish;
     this.Name       = name;
     this.Legs       = 0;
     this.Eyes       = 0;
 }
        public AnimalNode Dequeue(AnimalType type)
        {
            AnimalNode ret = null;

            switch(type)
            {
                case AnimalType.Cat:
                    ret = _headCat;
                    _headCat.Last.Next = _headCat.Next;
                    _headCat = _headCat.NextSame;
                    break;

                case AnimalType.Dog:
                    ret = _headDog;
                    _headDog.Last.Next = _headDog.Next;
                    _headDog = _headDog.NextSame;
                    break;
            }

            if(ret == _head)
            {
                _head = _head.Next;
            }

            return ret;
        }
예제 #10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var animalType = new AnimalType
            {
                Id      = Guid.NewGuid(),
                Code    = "02",
                Name    = "name02",
                Created = DateTime.Now
            };

            using (var unitOfWork = new UnitOfWork())
            {
                unitOfWork.RepoFactory.AnimalTypeRepository.Add(animalType);
                unitOfWork.SaveChanges();
            }

            var exitingtype = new UnitOfWork().RepoFactory.AnimalTypeRepository.GetAll().FirstOrDefault();

            if (exitingtype != null)
            {
                Console.WriteLine($"{exitingtype.Name}");
            }
        }
예제 #11
0
 void Awake()
 {
     power       = (int)animalType;
     lastType    = animalType;
     maxDistance = moveDistance;
     levelText   = transform.Find("3Dtext").GetComponent <TextMesh>();
 }
        public void GetAnimals_ShouldReturnAnimals_WhenNoId()
        {
            List <AnimalType> animalTypes = animalTypeRepository.GetAnimalTypes().ToList();

            Assert.AreEqual(mockAnimalTypes.Count, animalTypes.Count);
            Assert.IsTrue(mockAnimalTypes.SequenceEqual(animalTypes));

            AnimalType updatedAnimalType = new AnimalType()
            {
                Id                     = 1,
                AnimalTypeName         = "Doggy",
                HappinessDeductionRate = 9,
                HungerIncreaseRate     = 8
            };

            animalTypeRepository.UpdateAnimalType(1, updatedAnimalType);

            animalTypes = animalTypeRepository.GetAnimalTypes().ToList();

            //When a value is amended, the Repo should maintian order by Id
            for (int i = 0; i < mockAnimalTypes.Count; i++)
            {
                Assert.AreEqual(i + 1, animalTypes[i].Id);
            }
        }
예제 #13
0
        public void SpawnRandomAnimal()
        {
            Animal            a;
            OrderedPair <int> spawnLocation = Utilities.GetRandomPoint();
            int x = spawnLocation.X;
            int y = spawnLocation.Y;

            AnimalType animalType = UtilityDecider <AnimalType> .WeightedRandomChoice(animalSpawnWeights);

            switch (animalType)
            {
            case AnimalType.Bear:
                a = Animal.CreateBear(x, y);
                break;

            case AnimalType.Wolf:
                a = Animal.CreateWolf(x, y);
                break;

            case AnimalType.Hog:
                a = Animal.CreateHog(x, y);
                break;

            default:
                a = Animal.CreateGoat(x, y);
                break;
            }

            Console.WriteLine("Spawning a {0}", animalType);
            EntitiesAdd(a);
        }
예제 #14
0
        public static string GetPetEffectDescription(this AnimalType animalType)
        {
            switch (animalType)
            {
            case AnimalType.Any:
                return($"Pet any animal by touching it");

            case AnimalType.Chicken:
            case AnimalType.Duck:
            case AnimalType.Rabbit:
            case AnimalType.Dinosaur:
            case AnimalType.Cow:
            case AnimalType.Goat:
            case AnimalType.Pig:
            case AnimalType.Hog:
                return($"Pet {animalType.ToString().ToLower()}s by touching them");

            case AnimalType.Sheep:
                return($"Pet sheep by touching them");

            case AnimalType.Ostrich:
                return($"Pet ostriches by touching them");

            default:
                return("");
            }
        }
예제 #15
0
        public static Animal CreateAnimal(AnimalType type, string name, User user)
        {
            Guard.Against.Null(type, nameof(type));
            Guard.Against.NullOrEmpty(name, nameof(name));
            Guard.Against.Null(user, nameof(user));

            switch (type)
            {
            case AnimalType.Cat:
                return(new Animal(type, name, user, 2, 4));

            case AnimalType.Dog:
                return(new Animal(type, name, user, 4, 6));

            case AnimalType.GuineaPig:
                return(new Animal(type, name, user, 6, 8));

            case AnimalType.Rabbit:
                return(new Animal(type, name, user, 3, 10));

            case AnimalType.Tortoise:
                return(new Animal(type, name, user, 1, 1));

            default:
                throw new InvalidOperationException("Must require an animal type");
            }
        }
예제 #16
0
    public GameObject FindClosestAnimal(AnimalType animal, GameObject searchingAnimal, bool idleOnly, bool checkFurthest)
    {
        PopulatePrairieDogList();
        PopulateIdlePrairieDogList();
        Vector2 myPosition = searchingAnimal.transform.position;

        List<GameObject> animalList = new List<GameObject>();
        if(animal == AnimalType.prairieDog && !idleOnly)
            animalList = prairieDogList;
        if(animal == AnimalType.prairieDog && idleOnly)
            animalList = idlePrairieDogList;

        GameObject closest;
        if(animalList[0] != searchingAnimal)
            closest = animalList[0];
        else
            closest = animalList[1];

        for (int i = 0; i < animalList.Count; i++)
        {
            if(animalList[i] != searchingAnimal)
            {
                float currentDistance = Vector2.Distance(closest.transform.position, myPosition);
                float newDistance = Vector2.Distance(animalList[i].transform.position, myPosition);
                if((!checkFurthest && newDistance < currentDistance) || (checkFurthest && newDistance > currentDistance))
                    closest = animalList[i];
            }
        }
        return closest;
    }
예제 #17
0
        /// <summary>
        /// The type of animal being read.
        /// </summary>
        /// <returns> The type of animal.</returns>
        public static AnimalType ReadAnimalType()
        {
            AnimalType result = AnimalType.Dingo;

            string stringValue = result.ToString();

            bool found = false;

            while (!found)
            {
                stringValue = ConsoleUtil.ReadAlphabeticValue("AnimalType");

                stringValue = ConsoleUtil.InitialUpper(stringValue);

                // If a matching enumerated value can be found...
                if (Enum.TryParse <AnimalType>(stringValue, out result))
                {
                    found = true;
                }
                else
                {
                    Console.WriteLine("Invalid animal type.");
                }
            }

            return(result);
        }
예제 #18
0
        public AnimalTypeCreatedDTO UpdateAnimalType(int id, AnimalTypeCreationDTO updatedAnimalType)
        {
            try
            {
                animalTypeRepository.GetAnimalTypeById(id);
            }
            //Handled by controller logic
            catch (InvalidOperationException)
            {
                throw;
            }
            //Unexpected result, throw internal server error
            catch (Exception)
            {
                throw;
            }

            AnimalType animalType = Mapper.Map <AnimalType>(updatedAnimalType);

            //Not needed if using EF database with sequential column
            animalType.Id = id;

            AnimalTypeCreatedDTO returnValue = Mapper.Map <AnimalTypeCreatedDTO>(animalTypeRepository.UpdateAnimalType(id, animalType));

            return(returnValue);
        }
예제 #19
0
        public Animal GetAnimal(AnimalType animalType)
        {
            var ns       = typeof(AnimalType).Namespace; //or your classes namespace if different
            var typeName = ns + "." + animalType.ToString();

            return((Animal)Activator.CreateInstance(Type.GetType(typeName)));
        }
예제 #20
0
        public void DeleteAnimalType(int id)
        {
            AnimalType animalType = null;

            try
            {
                // I don't need to convert to a DTO therefore am calling repo rather than manager
                animalType = animalTypeRepository.GetAnimalTypeById(id);
            }
            //I am using .First therefore it can throw Exceptions
            //FirstOrDefault returns in the Default Value therefore am not using
            catch (InvalidOperationException)
            {
                //Handled in controller
                throw;
            }
            if (animalType != null)
            {
                animalTypeRepository.DeleteAnimalType(animalType);
            }
            else //Internal Server Error
            {
                throw new Exception();
            }
        }
예제 #21
0
        public AnimalTypeCreationDTO GetFullAnimalTypeById(int id)
        {
            AnimalType            animalType  = animalTypeRepository.GetAnimalTypeById(id);
            AnimalTypeCreationDTO returnValue = Mapper.Map <AnimalTypeCreationDTO>(animalType);

            return(returnValue);
        }
예제 #22
0
    public Animal()
    {
        var names = Enum.GetNames(typeof(AnimalType));
        var name  = names[new System.Random().Next(0, names.Length)];

        Type = (AnimalType)Enum.Parse(typeof(AnimalType), name);
    }
예제 #23
0
        public static void Spawn(GameObject prefab, int amount, WorldGridSystem worldGridSystem)
        {
            GridData   grid       = worldGridSystem.Grid;
            AnimalType animalType = prefab.GetComponentInChildren <AnimalTypeAuthoring>().animalType;

            bool lookingForFreeTile;
            int  length = grid.Length;

            for (int i = 0; i < amount; i++)
            {
                lookingForFreeTile = true;
                while (lookingForFreeTile)
                {
                    int n = Random.Range(0, length);
                    if (worldGridSystem.IsWalkable(animalType.Land, animalType.Water,
                                                   grid.GetGridPositionFromIndex(n)))
                    {
                        Vector3 spawnPos = grid.GetWorldPosition(grid.GetGridPositionFromIndex(n));
                        spawnPos.y = 1f;
                        GameObject animal = Instantiate(prefab, spawnPos, Quaternion.Euler(0, Random.Range(0, 360), 0));
                        animal.GetComponentInChildren <AgeAuthoring>().Age = animalType.Lifespan * Random.value;
                        lookingForFreeTile = false;
                    }
                }
            }
        }
예제 #24
0
        public int Create(AnimalType item)
        {
            _context.AnimalTypes.Add(item);
            _context.SaveChanges();

            return(item.Id);
        }
예제 #25
0
        /// <summary>
        /// Method for adding an animal to the <see cref="Zoo"/>.
        /// </summary>
        /// <param name="animalType">The type of animal being added to the <see cref="Zoo"/>.</param>
        /// <param name="animalHealthBar">The health bar of the animal.</param>
        /// <param name="animalStatusLabel">The status <see cref="Label"/> of the animal.</param>
        /// <param name="animalHealthLabel">The health <see cref="Label"/> of the animal.</param>
        public void AddAnimal(
            AnimalType animalType,
            ProgressBar animalHealthBar,
            Label animalStatusLabel,
            Label animalHealthLabel)
        {
            switch (animalType)
            {
            case AnimalType.Monkey:
                if (_animals.Count(x => x.Type == AnimalType.Monkey) < 6)
                {
                    _animals.Add(
                        new Monkey(
                            animalHealthBar,
                            animalStatusLabel,
                            animalHealthLabel,
                            _random));
                }
                else
                {
                    throw new InvalidOperationException("The zoo cannot have more than 5 of each animal type");
                }

                break;

            case AnimalType.Elephant:
                if (_animals.Count(x => x.Type == AnimalType.Elephant) < 6)
                {
                    _animals.Add(
                        new Elephant(
                            animalHealthBar,
                            animalStatusLabel,
                            animalHealthLabel,
                            _random));
                }
                else
                {
                    throw new InvalidOperationException("The zoo cannot have more than 5 of each animal type");
                }

                break;

            case AnimalType.Giraffe:
                if (_animals.Count(x => x.Type == AnimalType.Giraffe) < 6)
                {
                    _animals.Add(
                        new Giraffe(
                            animalHealthBar,
                            animalStatusLabel,
                            animalHealthLabel,
                            _random));
                }
                else
                {
                    throw new InvalidOperationException("The zoo cannot have more than 5 of each animal type");
                }

                break;
            }
        }
예제 #26
0
        public AnimalType CreateAnimalType(string name)
        {
            var auxAnimalType = new AnimalType();

            auxAnimalType.Name = name;
            return(auxAnimalType);
        }
예제 #27
0
 public Animal(string pName, AnimalType pAnimalType, DateTime pBirthDate, Food pFavouriteFood)
 {
     this.AnimalName    = pName;
     this.AnimalType    = pAnimalType;
     this.BirthDate     = pBirthDate;
     this.FavouriteFood = pFavouriteFood;
 }
예제 #28
0
        Animal(AnimalType type, string name, User user, int petRate = 5, int hungryRate = 5)
        {
            Guard.Against.Null(type, nameof(type));
            Guard.Against.NullOrEmpty(name, nameof(type));
            Guard.Against.Null(user, nameof(user));

            Guard.Against.OutOfRange(petRate, nameof(petRate), 1, 10);
            Guard.Against.OutOfRange(hungryRate, nameof(hungryRate), 1, 10);

            Id         = Guid.NewGuid();
            Name       = name;
            AnimalType = type;
            CreatedAt  = DateTimeOffset.Now;
            LastFed    = DateTimeOffset.Now;
            LastPetted = DateTimeOffset.Now;
            HungryRate = hungryRate;
            PetRate    = petRate;
            User       = user;

            _currentHappiness   = 50;
            _previousHungriness = 50;

            AnimalList.Add(this);

            user.AddAnimalToUser(this);
        }
예제 #29
0
        /// <summary>
        /// Returns a list of breeds for a particular animal.
        /// </summary>
        /// <param name="AnimalType">Type of Animal</param>
        /// <returns></returns>
        public List <string> GetBreedList(AnimalType AnimalType)
        {
            // XML return type: petfinderBreedList
            List <string> breedList = new List <string>();

            return(breedList);
        }
예제 #30
0
        public IEnumerable <AnimalType> ParseTypes(TextReader file)
        {
            var    animalTypes = new List <AnimalType>();
            string line        = null;

            while ((line = file.ReadLine()) != null)
            {
                var data = line.Split(";");


                double meatPercent = 0;
                if (data.Length == 4 && data[3] != "")
                {
                    var percent = data[3].Replace("%", "");
                    meatPercent = double.Parse(percent, CultureInfo.InvariantCulture) / 100;
                }

                var ratio      = double.Parse(data[1], CultureInfo.InvariantCulture);
                var dietType   = GetDietType(data[2]);
                var name       = data[0];
                var animalType = new AnimalType(name, ratio, dietType, meatPercent);

                animalTypes.Add(animalType);
            }

            return(animalTypes);
        }
예제 #31
0
        public JsonResult DeleteAnimalType(AnimalType ObjDelete)
        {
            MsgUnit Msg = new MsgUnit();

            try
            {
                var userId   = User.Identity.GetUserId();
                var UserInfo = _unitOfWork.UserAccount.GetUserByID(userId);
                ObjDelete.CompanyID = UserInfo.fCompanyId;
                if (!ModelState.IsValid)
                {
                    string Err    = " ";
                    var    errors = ModelState.Values.SelectMany(v => v.Errors);
                    foreach (ModelError error in errors)
                    {
                        Err = Err + error.ErrorMessage + " * ";
                    }
                    Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + Err;
                    Msg.Code = 0;
                    return(Json(Msg, JsonRequestBehavior.AllowGet));
                }
                _unitOfWork.AnimalType.Delete(ObjDelete);
                _unitOfWork.Complete();
                Msg.Code = 1;
                Msg.Msg  = Resources.Resource.DeletedSuccessfully;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Msg.Msg  = Resources.Resource.SomthingWentWrong + " : " + ex.Message.ToString();
                Msg.Code = 0;
                return(Json(Msg, JsonRequestBehavior.AllowGet));
            }
        }
예제 #32
0
        public int GetInitialAnimalPopulation(AnimalType type)
        {
            string input = "";

            switch (type)
            {
            case AnimalType.SQUIRREL:
                input = _controlSquirrelPopulationInputField.text;
                break;

            case AnimalType.FOX:
                input = _controlFoxPopulationInputField.text;
                break;

            default:
                return(-1);
            }

            try
            {
                int result = Int16.Parse(input);
                return(result);
            }
            catch {
                return(-1);
            }
        }
예제 #33
0
파일: Animal.cs 프로젝트: kmichel/passeur
 public Animal(AnimalType type, int row, int column)
 {
     this.type = type;
     this.row = row;
     this.column = column;
     age = 0;
 }
예제 #34
0
 public Animal(string name, int legs, int eyes)
 {
     this.animalType = AnimalType.Fish;
     this.Name       = name;
     this.Legs       = legs;
     this.Eyes       = eyes;
 }
예제 #35
0
 public void BindAnimalTypes()
 {
     ddlAnimalType.DataSource     = AnimalType.GetAnimalType();
     ddlAnimalType.DataValueField = "AnimalTypeID";
     ddlAnimalType.DataTextField  = "Type";
     ddlAnimalType.DataBind();
 }
예제 #36
0
 public Animal(string name, int age, Gender sex)
 {
     this.Name = name;
     this.Age  = age;
     this.Sex  = sex;
     this.Type = AnimalType.NotDefined;
 }
예제 #37
0
 public void addAnimalTexture(AnimalType type, Model model)
 {
     int index = (int)type;
     for (int i = animalLooks.Count; i <= index; i++) {
         animalLooks.Add(null);
         textureTranslations.Add(Vector2.Zero);
     }
     animalLooks[index] = model;
     //textureTranslations[index] = new Vector2(tex.Width / 2, tex.Height / 2);
 }
예제 #38
0
 public List<Dangerous> findDangerousByType(AnimalType type)
 {
     List<Dangerous> dangerouses = new List<Dangerous>();
     foreach (Animal animal in this.animals)
     {
         if ( (animal is Dangerous) && ( animal.Type == type) )
         {
             dangerouses.Add((Dangerous)animal);
         }
     }
     return dangerouses;
 }
예제 #39
0
        public ModifyAnimalForm(Animal animal, AdministrationForm administrationForm)
        {
            if (animal == null)
            {
                throw new ArgumentNullException("animal");
            }

            if (administrationForm == null)
            {
                throw new ArgumentNullException("administrationForm");
            }

            InitializeComponent();

            this.animal = animal;
            this.administrationForm = administrationForm;

            Cat cat = animal as Cat;
            if(cat != null)
            {
                ShowCatFields();
                if (cat.BadHabits != null)
                {
                    inputBadHabits.Text = cat.BadHabits;
                }

                animalType = AnimalType.Cat;
            }
            else
            {
                Dog dog = animal as Dog;
                if(dog == null)
                {
                    //We don't know what kind of animal this is, so we cannot modify it.
                    throw new InvalidOperationException();
                }
                ShowDogFields();
                if (dog.LastWalkDate != null)
                {
                    inputLastWalkDate.Value =
                         new DateTime(dog.LastWalkDate.Year, dog.LastWalkDate.Month, dog.LastWalkDate.Day);
                }

                animalType = AnimalType.Dog;
            }

            inputName.Text = animal.Name;
            inputBirthDate.Value =
                new DateTime(animal.DateOfBirth.Year, animal.DateOfBirth.Month, animal.DateOfBirth.Day);
            checkbox_Reserved.Checked = animal.IsReserved;
        }
        public void AnimalWithLowerRankCanNotEatAnother(AnimalType attackingAnimalType, AnimalType otherAnimalType)
        {
            //Arrange
            CreateOpponentAnimals(attackingAnimalType, otherAnimalType);
            ArrangeForTwoAnimals();

            //Act
            bool hasMoved = attackingAnimal.TryMove(destMock.Object);

            //Assert
            Assert.False(hasMoved);
            Assert.That(otherAnimalCellMock.Object.Animal, Is.EqualTo(otherAnimal));
            Assert.That(attackingAnimalCellMock.Object.Animal, Is.EqualTo(attackingAnimal));
        }
예제 #41
0
 public static IAnimal CreateAnimal(AnimalType type, string name)
 {
     switch (type)
     {
         case AnimalType.Dog:
             return new Dog(name);
         case AnimalType.Lion:
             return new Lion(name);
         case AnimalType.Ostrich:
             return new Ostrich(name);
         default:
             throw new ArgumentException("The animal " + type.ToString() + " can not be created because is not part of our animal.");
     }
 }
예제 #42
0
    public static Animal Make(AnimalType type) {
        Animal result = null;

        switch (type)
        {
            case AnimalType.Bear:
                result = new Bear();
                break;            
            case AnimalType.Dragon:
                result = new Dragon();
                break;            
            default:
                result = new Tiger();
                break;            
        } 

        return result;
    }
예제 #43
0
 public void Raise(AnimalType alt)
 {
     switch (alt)
     {
         case AnimalType.Bird:
             AnimalSet.bird.Eat();
             AnimalSet.bird.Sleep();
             break;
         case AnimalType.Dog:
             AnimalSet.dog.Eat();
             AnimalSet.dog.Sleep();
             break;
         case AnimalType.Fish:
             AnimalSet.fish.Eat();
             AnimalSet.fish.Sleep();
             break;
     }
 }
예제 #44
0
    public void Init(Vector3 _spawnPos)
    {
        //create a random type based on percent weights
        float thisRand = Random.Range(0.0f, 1.0f);

        //generate animal type
        if (thisRand > wormPercentage)
        {
            this.type = AnimalType.chickhen;
            //this.gameObject.GetComponent<SpriteRenderer>().sprite = animalSprites[2];
        }
        else if (thisRand > rabbitPercentage)
        {
            this.type = AnimalType.rabbit;
            //this.gameObject.GetComponent<SpriteRenderer>().sprite = animalSprites[1];
        }
        else
        {
            this.type = AnimalType.worm;
            //this.gameObject.GetComponent<SpriteRenderer>().sprite = animalSprites[0];
        }
        transform.position = _spawnPos;
    }
예제 #45
0
 public bool CanStore(int amount, AnimalType type)
 {
     if (type == AcceptedType && CurrentCapacity + amount <= MaxCapacity)
         return true;
     return false;
 }
예제 #46
0
 public void replaceAnimalTexture(AnimalType type, Model model)
 {
     int index = (int)type;
     if(index <= animalLooks.Count)
     {
         animalLooks[index] = model;
     }
 }
예제 #47
0
 public Turtle(String petName, AnimalType type, Random rand)
     : base(petName, type, rand)
 {
 }
 public AnimalNode(AnimalType type, string name)
 {
     AnimalType = type;
     Name = name;
 }
예제 #49
0
파일: Island.cs 프로젝트: kmichel/passeur
 public void CreateAnimals(AnimalType type, int count)
 {
     for (var animalCount = 0; animalCount < count;)
         if (TryCreateAnimal(type))
             ++animalCount;
 }
예제 #50
0
 public Animal(AnimalType animalType, PlayerType playerType)
 {
     AnimalType = animalType;
     this.playerType = playerType;
 }
예제 #51
0
 public void FindTarget(AnimalType animal)
 {
     animalTarget = animalMap.FindClosestAnimal(animal, gameObject, false, false);
     myState = BehaviorState.pursue;
 }
예제 #52
0
파일: Level.cs 프로젝트: MSigma/ZooBurst
 private bool SpeciesMatch(int x, int y, AnimalType typeToMatch) => (GetSpeciesIdAt(x, y) == typeToMatch);
예제 #53
0
파일: Animal.cs 프로젝트: bramom/Bug.RS
 public Animal(string name, AnimalType animalType)
 {
     Name = name;
     Type = animalType;
 }
예제 #54
0
 public static Animal Make(AnimalType type) {
     System.Type t = registry[type];
     return (Animal) Activator.CreateInstance(t);
 }
예제 #55
0
파일: Animal.cs 프로젝트: MSigma/ZooBurst
 public Animal(int x, int y, AnimalType species)
 {
     X = x;
     Y = y;
     Species = species;
 }
예제 #56
0
 public Platypus(String petName, AnimalType type, Random rand)
     : base(petName, type, rand)
 {
 }
예제 #57
0
파일: Island.cs 프로젝트: kmichel/passeur
 public bool TryCreateAnimal(AnimalType type)
 {
     var row = RandInt(0, size);
     var column = RandInt(0, size);
     if (IsWalkableAndAvailable(row, column)) {
         animals.Add(new Animal(type, row, column));
         return true;
     }
     return false;
 }
 private void CreateAllyAnimals(AnimalType attackingAnimalType, AnimalType otherAnimalType)
 {
     attackingAnimal = new Animal(attackingAnimalType, PlayerType.BottomPlayer);
     otherAnimal = new Animal(otherAnimalType, PlayerType.BottomPlayer) {Cell = otherAnimalCellMock.Object};
 }
예제 #59
0
        private void inputAnimalType_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (inputAnimalType.Text)
            {
                case "Cat":
                    ShowCatFields();
                    animalType = AnimalType.Cat;
                    break;

                case "Dog":
                    ShowDogFields();
                    animalType = AnimalType.Dog;
                    break;
            }
        }
예제 #60
0
 public static Animal Make(AnimalType type) {
     Func<Animal> f = registry[type];
     Animal result = f();
     return result;
 }