Ejemplo n.º 1
0
        public void DisplayInteractResult(Animal selectedPet, Toy selectedToy, InteractResult interactResult)
        {
            switch (interactResult)
            {
            case Animal.InteractResult.Played:
                Console.WriteLine($"{name} leker med {selectedPet.Name} med en {selectedToy.ToString()}{selectedToy.GetType().Name}");
                break;

            case Animal.InteractResult.Hungry:
                Console.WriteLine($"{name} is hugry and will not play!");
                break;

            case Animal.InteractResult.NotInMood:
                Console.WriteLine($"{name} are not in the mood right now!");
                break;

            case Animal.InteractResult.ToyBroken:
                Console.WriteLine("Toy is broken, cant play with it!");
                break;
            }
        }
Ejemplo n.º 2
0
        public override InteractResult Interact(Toy toy)
        {
            if (hungry)
            {
                return(InteractResult.Hungry);
            }

            if (toy.IsBroken)
            {
                return(InteractResult.ToyBroken);
            }

            energy = energy - 1;

            if (energy == 0)
            {
                hungry = true;
            }

            toy.LowerQuality(damage);

            return(InteractResult.Played);
        }
Ejemplo n.º 3
0
 public abstract InteractResult Interact(Toy toy);