Example #1
0
        public Species addSpecies(String name, speciesStats stats)
        {
            //Check if valid input
            Species newSpecies = new Species(name, stats);
            speciesTemp.Add(newSpecies);
            rescanSpecies();

            return newSpecies;
        }
Example #2
0
        //constructor
        public Creature(int xPos, int yPos, Ecosystem.speciesStats stats, Random seed, Species parent)
        {
            this.parent = parent;
            diet = stats.diet;
            switch (diet)
            {
                case 0:
                    spriteRectangle = Sprites.herbivore;
                    break;
                case 1:
                    spriteRectangle = Sprites.carnivore;
                    break;
                default:
                    spriteRectangle = Sprites.mormo;
                    break;
            }
            size = stats.size;
            detection = stats.detection;
            speed = stats.speed;
            energyCap = stats.energyCap;
            foodCap = stats.foodCap;
            waterCap = stats.waterCap;
            energyValue = stats.energyValue;
            agility = stats.agility;

            color = stats.color;

            random = seed;

            position = new Vector2(xPos, yPos);

            orientation = new float();
            origin = new Vector2(spriteRectangle.Width / 2, spriteRectangle.Height / 2);

            body = new RotatedRectangle(new Rectangle(xPos - size / 2, yPos - size / 2, size, size), orientation);

            state = 0; //wander
            food = 0;
            water = waterCap;
            energy = energyCap;
            currSpeed = 1f;
            deathtimer = new TimeSpan(0, 0, 0);
            feedTimer = new TimeSpan(0, 0, 0);
            sprintTime = new TimeSpan(0, 0, 0);
            restTime = new TimeSpan(0, 0, 0);
            //Death
            corpseTimer = new TimeSpan(0, 0, 0);
            rotTime = 15;
            rotStage = 0;

            this.stamina = 6;

            this.mapWidth = 1920;   //hmm
            this.mapHeight = 1920;

            foodValue = 30;//Should be tweeked(size)

            randomGoal(mapWidth, mapHeight);
            //animation offset
            frameOffset = random.Next(4);

            //REMOVE THIS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            if(diet == 1)
                this.energyCap *= 5;
        }
Example #3
0
 public void showSpecies(Species target)
 {
     selectedPerkNode = null;
     for (int i = 0; i < target.perks.Length; i++)
     {
         perks[i].bought = target.perks[i];
         perks[i].Selected = false;
     }
     if (perks[0].bought)
         perks[1].blocked = true;
     else
         perks[0].blocked = true;
 }