/// <summary>
 /// Default constructor. Initialises properites and variables to 'default' values.
 /// </summary>
 /// <param name="species">The species of this animal.</param>
 /// <param name="location">The start location of this animal.</param>
 /// <param name="foodSource">The food source of this animal.</param>
 /// <param name="helper">An instance of IHelper.</param>
 /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
 /// <param name="drawPublisher">An instance of DrawPublisher.</param>
 /// <param name="mapInformation">An instance of MapInformation.</param>
 public Dioecious(string species, Vector location, IHelper helper, LifeformPublisher lifeformPublisher, DrawPublisher drawPublisher, MapInformation mapInformation, char gender = (char)0) : base(species, location, helper, lifeformPublisher, drawPublisher, mapInformation)
 {
     if (gender == 0)
     {
         Gender = GenderGenerator();
     }
     else
     {
         Gender = gender;
     }
     this.lifeformPublisher.RaisePossibleMatesEvent += CanMateEventHandler;
 }
Beispiel #2
0
        /// <summary>
        /// Thread that loops the AI events.
        /// </summary>
        private void AIThread()
        {
            DateTime lastTime = DateTime.Now;

            while (true)
            {
                double passedTime = (DateTime.Now - lastTime).TotalSeconds;
                if (passedTime >= TimeInSecondsBetweenFrames)
                {
                    lastTime = DateTime.Now;
                    LifeformPublisher.AI((float)passedTime);
                }
            }
        }
        /// <summary>
        /// Default constructor. Initialises properites and variables to 'default' values.
        /// </summary>
        /// <param name="species">The species of this animal.</param>
        /// <param name="location">The start location of this animal.</param>
        /// <param name="foodSource">The food source of this animal.</param>
        /// <param name="helper">An instance of IHelper.</param>
        /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
        /// <param name="drawPublisher">An instance of DrawPublisher.</param>
        /// <param name="mapInformation">An instance of MapInformation.</param>
        public Eukaryote(string species, Vector location, IHelper helper, LifeformPublisher lifeformPublisher, DrawPublisher drawPublisher, MapInformation mapInformation) : this(helper, lifeformPublisher, drawPublisher, mapInformation)
        {
            Species       = species;
            Location      = location;
            HuntedBy      = new string[0];
            MaxHealth     = 100;
            Health        = MaxHealth;
            MaxAge        = 10;
            NutrientValue = 50;

            ContactCooldownLength = 0.5f;

            Colour = new Colour(122, 122, 122);
            Design = new Point[] { new Point(0, 0), new Point(4, 0), new Point(4, 4), new Point(0, 4) };
        }
    {                                         //after all, some plants reproduce through fire.
        /// <summary>
        /// Default constructor. Initialises properites and variables to 'default' values.
        /// </summary>
        /// <param name="species">The species of this animal.</param>
        /// <param name="location">The start location of this animal.</param>
        /// <param name="foodSource">The food source of this animal.</param>
        /// <param name="helper">An instance of IHelper.</param>
        /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
        /// <param name="drawPublisher">An instance of DrawPublisher.</param>
        /// <param name="mapInformation">An instance of MapInformation.</param>
        public MonoeciousPlant(string species, Vector location, IHelper helper, LifeformPublisher lifeformPublisher, DrawPublisher drawPublisher, MapInformation mapInformation) : base(species, location, helper, lifeformPublisher, drawPublisher, mapInformation)
        {
            spreadRange     = 140;
            offspringAmount = (1, 3);

            lengthOfReproduction = 20;
            reproductionCooldown = OneAgeInSeconds * 2;

            NutrientValue = 14;

            MaxHealth       = 100;
            Health          = MaxHealth;
            MaxAge          = 4;
            ReproductionAge = 2;

            Colour = new Colour(100, 200, 0);
            Design = new Point[] { new Point(3, 0), new Point(6, 3), new Point(3, 6), new Point(0, 3) };
        }
Beispiel #5
0
        /// <summary>
        /// Default constructor. Initialises properites and variables to 'default' values.
        /// </summary>
        /// <param name="species">The species of this animal.</param>
        /// <param name="location">The start location of this animal.</param>
        /// <param name="foodSource">The food source of this animal.</param>
        /// <param name="helper">An instance of IHelper.</param>
        /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
        /// <param name="drawPublisher">An instance of DrawPublisher.</param>
        /// <param name="mapInformation">An instance of MapInformation.</param>
        public DioeciousPlant(string species, Vector location, IHelper helper, LifeformPublisher lifeformPublisher, DrawPublisher drawPublisher, MapInformation mapInformation, char gender = (char)0) : base(species, location, helper, lifeformPublisher, drawPublisher, mapInformation, gender)
        {
            spreadRange     = 240;
            offspringAmount = (2, 3);

            lengthOfReproduction = 8;
            reproductionCooldown = OneAgeInSeconds * 3;

            NutrientValue = 40;

            MaxHealth       = 100;
            Health          = MaxHealth;
            MaxAge          = 7;
            ReproductionAge = 3;
            distanceDivider = 25;

            Colour = new Colour(200, 100, 0);
            Design = new Point[] { new Point(3, 0), new Point(6, 3), new Point(3, 6), new Point(0, 3) };
        }
        /// <summary>
        /// Sets all instances of classes and interfaces, sets properties that depends on these and subscribes the event handlers to the events.
        /// </summary>
        /// <param name="helper">The instance of IHelper.</param>
        /// <param name="lifeformPublisher">The instance of AnimalPublisher.</param>
        /// <param name="drawPublisher">The instance of DrawPublisher.</param>
        /// <param name="mapInformation">The instance of MapInformation.</param>
        private Eukaryote(IHelper helper, LifeformPublisher lifeformPublisher, DrawPublisher drawPublisher, MapInformation mapInformation)
        {
            this.helper            = helper;
            this.lifeformPublisher = lifeformPublisher;
            this.drawPublisher     = drawPublisher;
            this.mapInformation    = mapInformation;

            OneAgeInSeconds = mapInformation.OneAgeInSeconds;
            ID = helper.GenerateID();

            this.lifeformPublisher.RaiseFindPreyEvent   += IsPossiblePreyEventHandler;
            this.lifeformPublisher.RaiseSetPreyEvent    += IsPreyEventHandler;
            this.lifeformPublisher.RaiseRemovePreyEvent += RemovePredatorEventHandler;
            this.lifeformPublisher.RaiseAIEvent         += ControlEventHandler;
            this.lifeformPublisher.RaiseDied            += DeathEventHandler;
            this.lifeformPublisher.RaiseEaten           += EatenEventHandler;
            this.lifeformPublisher.RaiseGetLocation     += LocationEventHandler;
            this.lifeformPublisher.RaiseDamage          += DamageEventHandler;
            this.lifeformPublisher.RaiseGetAllLocations += GetAllLocationsEventHandler;

            this.drawPublisher.RaiseDrawEvent             += DrawEventHandler;
            this.drawPublisher.RaiseSpeciesAndAmountEvent += SpeciesAmountEventHandler;
        }
Beispiel #7
0
        /// <summary>
        /// Default constructor. Initialises properites and variables to 'default' values.
        /// </summary>
        /// <param name="species">The species of this animal.</param>
        /// <param name="location">The start location of this animal.</param>
        /// <param name="foodSource">The food source of this animal.</param>
        /// <param name="helper">An instance of IHelper.</param>
        /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
        /// <param name="drawPublisher">An instance of DrawPublisher.</param>
        /// <param name="mapInformation">An instance of MapInformation.</param>
        public BirdCarnivore(string species, Vector location, string[] foodSource, IHelper helper, LifeformPublisher animalPublisher, DrawPublisher drawPublisher, MapInformation mapInformation) : base(species, location, foodSource, helper, animalPublisher, drawPublisher, mapInformation)
        {
            MaximumHeight  = 100;
            CanDive        = true;
            AscendSpeed    = 8f;
            DiveSpeed      = 26f;
            DesendSpeed    = 12f;
            AscendModifier = 1.3f; //mention in the xml that 1 is 100 %
            DesendModifier = 0.8f;
            HoverModifier  = 0.4f;
            CircleRange    = 120f;

            MovementSpeed = 20;

            AttackRange           = 30;
            AttackSpeedMultiplier = 1.1f;

            BirthAmount          = (1, 1);
            reproductionCooldown = 40;
            lengthOfReproduction = 4;

            Design = new Point[] { new Point(0, 0), new Point(3, 3), new Point(6, 0), new Point(3, 6) };
            Colour = new Colour(100, 255, 255);
        }
Beispiel #8
0
        /// <summary>
        /// Default constructor. Initialises properites and variables to 'default' values.
        /// </summary>
        /// <param name="species">The species of this animal.</param>
        /// <param name="location">The start location of this animal.</param>
        /// <param name="foodSource">The food source of this animal.</param>
        /// <param name="helper">An instance of IHelper.</param>
        /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
        /// <param name="drawPublisher">An instance of DrawPublisher.</param>
        /// <param name="mapInformation">An instance of MapInformation.</param>
        public BirdHerbavore(string species, Vector location, string[] foodSource, IHelper helper, LifeformPublisher animalPublisher, DrawPublisher drawPublisher, MapInformation mapInformation) : base(species, location, foodSource, helper, animalPublisher, drawPublisher, mapInformation)
        {
            CanDive        = false;
            MaximumHeight  = 80;
            AscendSpeed    = 10f;
            DiveSpeed      = 0f;
            DesendSpeed    = 14f;
            AscendModifier = 1.3f;
            DesendModifier = 0.7f;
            HoverModifier  = 0.8f;
            CircleRange    = 0;

            MovementSpeed        = 18;
            BirthAmount          = (1, 1);
            reproductionCooldown = 40;
            lengthOfReproduction = 4;

            Design = new Point[] { new Point(0, 0), new Point(3, 3), new Point(6, 0), new Point(3, 6) };
            Colour = new Colour(255, 255, 255);
        }
Beispiel #9
0
        /// <summary>
        /// Default constructor. Initialises properites and variables to 'default' values.
        /// </summary>
        /// <param name="species">The species of this animal.</param>
        /// <param name="location">The start location of this animal.</param>
        /// <param name="foodSource">The food source of this animal.</param>
        /// <param name="helper">An instance of IHelper.</param>
        /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
        /// <param name="drawPublisher">An instance of DrawPublisher.</param>
        /// <param name="mapInformation">An instance of MapInformation.</param>
        public SleepingHerbavore(string species, Vector location, string[] foodSource, IHelper helper, LifeformPublisher lifeformPublisher, DrawPublisher drawPublisher, MapInformation mapInformation) : base(species, location, foodSource, helper, lifeformPublisher, drawPublisher, mapInformation)
        {
            MaxEnergyLevel     = 30;
            EnergyLevel        = MaxEnergyLevel;
            SleepLength        = 6;
            SleepModifer       = 0.4f;
            baseDiscoverChance = DiscoverChance;
            baseDiscoverRange  = DiscoverRange;

            BirthAmount = (2, 3);

            Colour = new Colour(0, 0, 255);
        }
Beispiel #10
0
 /// <summary>
 /// Default constructor. Initialises properites and variables to 'default' values.
 /// </summary>
 /// <param name="species">The species of this animal.</param>
 /// <param name="location">The start location of this animal.</param>
 /// <param name="foodSource">The food source of this animal.</param>
 /// <param name="helper">An instance of IHelper.</param>
 /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
 /// <param name="drawPublisher">An instance of DrawPublisher.</param>
 /// <param name="mapInformation">An instance of MapInformation.</param>
 public SleepingCarnivore(string species, Vector location, string[] foodSource, IHelper helper, LifeformPublisher lifeformPublisher, DrawPublisher drawPublisher, MapInformation mapInformation) : base(species, location, foodSource, helper, lifeformPublisher, drawPublisher, mapInformation)
 {
     AttackRange           = 20; //order these into groups.
     AttackSpeedMultiplier = 1.5f;
     lengthOfReproduction  = 9;
     genderInformation     = new (char Gender, byte Weight)[] { ('f', 50), ('m', 50) };
        /// <summary>
        /// Default constructor. Initialises properites and variables to 'default' values.
        /// </summary>
        /// <param name="species">The species of this animal.</param>
        /// <param name="location">The start location of this animal.</param>
        /// <param name="foodSource">The food source of this animal.</param>
        /// <param name="helper">An instance of IHelper.</param>
        /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
        /// <param name="drawPublisher">An instance of DrawPublisher.</param>
        /// <param name="mapInformation">An instance of MapInformation.</param>
        public HidingHerbavore(string species, Vector location, string[] foodSource, IHelper helper, LifeformPublisher lifeformPublisher, DrawPublisher drawPublisher, MapInformation mapInformation) : base(species, location, foodSource, helper, lifeformPublisher, drawPublisher, mapInformation)
        {
            MovementSpeed        = 10;
            CurrentMovementSpeed = MovementSpeed;
            Colour        = new Colour(0, 120, 120);
            NutrientValue = 100;

            genderInformation    = new (char Gender, byte Weight)[] { ('f', 50), ('m', 50) };
 /// <summary>
 /// Default constructor. Initialises properites and variables to 'default' values.
 /// </summary>
 /// <param name="species">The species of this animal.</param>
 /// <param name="location">The start location of this animal.</param>
 /// <param name="foodSource">The food source of this animal.</param>
 /// <param name="helper">An instance of IHelper.</param>
 /// <param name="lifeformPublisher">An instance of AnimalPublisher.</param>
 /// <param name="drawPublisher">An instance of DrawPublisher.</param>
 /// <param name="mapInformation">An instance of MapInformation.</param>
 public Carnivore(string species, Vector location, string[] foodSource, IHelper helper, LifeformPublisher lifeformPublisher, DrawPublisher drawPublisher, MapInformation mapInformation) : base(species, location, foodSource, helper, lifeformPublisher, drawPublisher, mapInformation)
 {
     Design = new Point[] { new Point(0, 0), new Point(8, 0), new Point(8, 8), new Point(0, 8) };
 }