public void ProductMouseTest()
        {
            var message = "Creator: the same creator's code has just worked with {Result of Mouse class}";
            var monitor = new MouseCreator();
            var result  = monitor.SomeOperation();

            message.Equals(result).Should().BeTrue();
        }
Example #2
0
    private void SpawnBestMouse()
    {
        new_best = false;
        GameObject mouse_obj = MouseCreator.CreateMouse(mouse, "Best_Mouse", "Best_Mouse");

        mouse_obj.transform.position += new Vector3(0, 0, -1);
        Destroy(mouse_obj.GetComponent <MouseScript>());
        mouse_obj.AddComponent <MouseBest>();
        mouse_obj.GetComponent <SpriteRenderer>().color = green.color;
        mouse_obj.GetComponent <MouseBest>().SetGenotype((double[])best_genotype.Clone());
    }
Example #3
0
        static void Main(string[] args)
        {
            List <Animal> animals = new List <Animal>();


            string command = Console.ReadLine();

            while (command != "End")
            {
                AnimalCreator animalCreator = null;
                FoodCreator   foodCreator   = null;

                string[] animalInput = command.Split();
                string   animalType  = animalInput[0];
                string   name        = animalInput[1];
                double   weight      = double.Parse(animalInput[2]);

                switch (animalType)
                {
                case "Hen":
                    double wingSize = double.Parse(animalInput[3]);
                    animalCreator = new HenCreator(name, weight, wingSize);
                    break;

                case "Owl":
                    wingSize      = double.Parse(animalInput[3]);
                    animalCreator = new OwlCreator(name, weight, wingSize);
                    break;

                case "Mouse":
                    string livingRegion = animalInput[3];
                    animalCreator = new MouseCreator(name, weight, livingRegion);
                    break;

                case "Cat":
                    livingRegion = animalInput[3];
                    string breed = animalInput[4];
                    animalCreator = new CatCreator(name, weight, livingRegion, breed);
                    break;

                case "Dog":
                    livingRegion  = animalInput[3];
                    animalCreator = new DogCreator(name, weight, livingRegion);
                    break;

                case "Tiger":
                    livingRegion  = animalInput[3];
                    breed         = animalInput[4];
                    animalCreator = new TigerCreator(name, weight, livingRegion, breed);
                    break;
                }

                string[] foodInput = Console.ReadLine().Split();
                string   foodType  = foodInput[0];
                int      quantity  = int.Parse(foodInput[1]);

                switch (foodType)
                {
                case "Vegetable":
                    foodCreator = new VegetableCreator(quantity);
                    break;

                case "Fruit":
                    foodCreator = new FruitCreator(quantity);
                    break;

                case "Meat":
                    foodCreator = new MeatCreator(quantity);
                    break;

                case "Seeds":
                    foodCreator = new SeedsCreator(quantity);
                    break;
                }

                Animal animal = animalCreator.CreateAnimal();
                Food   food   = foodCreator.CreateFood();

                Console.WriteLine(animal.AskForFood());
                try
                {
                    animal.Feed(food);
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex.Message);
                }

                animals.Add(animal);

                command = Console.ReadLine();
            }

            Console.WriteLine(string.Join(Environment.NewLine, animals));
        }
Example #4
0
    private void SpawnMouse(double[] genotype)
    {
        GameObject mouse_obj = MouseCreator.CreateMouse(mouse, "Mouse", "Mouse");

        mouse_obj.GetComponent <MouseScript>().SetGenotype(genotype);
    }
Example #5
0
    private void SpawnRandomMouse()
    {
        GameObject mouse_obj = MouseCreator.CreateMouse(mouse, "Mouse", "Mouse");

        mouse_obj.GetComponent <MouseScript>().SetRandomGenotype();
    }