コード例 #1
0
ファイル: Species.cs プロジェクト: rokes/CircleOfLife
 public Species(String speciesName, Ecosystem.speciesStats speciesStats, short xPos, short yPos)
 {
     name = speciesName;
     population = 1;
     stats = speciesStats;
     creatures.Add(new Creature(xPos, yPos, speciesStats));
 }
コード例 #2
0
ファイル: Creature.cs プロジェクト: kevinh111/CircleOfLife
        //constructor
        public Creature(int xPos, int yPos, Ecosystem.speciesStats stats)
        {
            diet = stats.diet;
            switch (diet)
            {
                case 0:
                    spriteRectangle = Sprites.herbivore;
                    break;
                case 1:
                    spriteRectangle = Sprites.carnivore;
                    break;
                default:
                    spriteRectangle = Sprites.flower;
                    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;

            position = new Vector2(xPos, yPos);

            orientation = new float();

            Rectangle body = new Rectangle(xPos, yPos, size, size);

            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);
            this.stamina = 6;

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

            foodValue = size * 2;//Should be tweeked

            randomGoal(mapWidth, mapHeight);
            //animation offset
            frameOffset = random.Next(4);
        }
コード例 #3
0
ファイル: Creature.cs プロジェクト: rokes/CircleOfLife
        //constructor
        public Creature(short xPos, short yPos, Ecosystem.speciesStats stats)
        {
            diet = stats.diet;
            size = stats.size;
            detection = stats.detection;
            speed = stats.speed;
            energyCap = stats.energyCap;
            foodCap = stats.foodCap;
            waterCap = stats.waterCap;

            position = new Vector2(xPos, yPos);
            orientation = new float();

            state = 0; //wander
            food = foodCap;
            water = waterCap;
            energy = energyCap;
        }
コード例 #4
0
ファイル: User.cs プロジェクト: ozzyonfire/CircleOfLife
        public User(Game game, Ecosystem ecosystem)
        {
            this.ecosystem = ecosystem;
            this.game = game;
            this.baseGame = (CircleOfLifeGame)game;

            //Initialize Nuclex Managers
            state = new Nuclex.Game.States.GameStateManager(game.Services);
            input = new InputManager(game.Services);
            gui = new GuiManager(game.Services);

            //Add nuclex managers to game components
            game.Components.Add(state);
            game.Components.Add(input);
            game.Components.Add(gui);

            //initialize input device objects
            keyboard = input.GetKeyboard();
            mouse = input.GetMouse();

            hudDestination = new Rectangle(0, (int)(baseGame.graphics.PreferredBackBufferHeight * 0.9f), baseGame.graphics.PreferredBackBufferWidth, (int)(baseGame.graphics.PreferredBackBufferHeight * 0.1f));
            //meh
            Initialize();
        }
コード例 #5
0
ファイル: Creature.cs プロジェクト: ozzyonfire/CircleOfLife
        //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;
        }
コード例 #6
0
 /// <summary>
 /// </summary>
 protected override void Initialize()
 {
     //Initialize ecosystem
     ecosystem = new Ecosystem(this, mapSizeX, mapSizeY);
     //Initialize user interface system
     user = new User(this, ecosystem);
     base.Initialize();
 }
コード例 #7
0
ファイル: Species.cs プロジェクト: ozzyonfire/CircleOfLife
 public Species(string speciesName, Ecosystem.speciesStats speciesStats)
 {
     name = speciesName;
     population = 1;
     stats = speciesStats;
 }