Пример #1
0
 public Animal(string nm, Point start_location, World w, gametime clock)
     : base(start_location, w, clock)
 {
     rest_data = new RestData(this,w,clock);
     name = nm;
     safety = 100;
 }
Пример #2
0
 // ---------------------------------------------------------------
 // Main Functions
 // ---------------------------------------------------------------
 // Adam is a test person. This spawns him and adds him to the world'
 static Person spawnAdam(World locale,gametime world_clock)
 {
     // the test person. Our Adam.
     Person adam = new Person("Adam", new Point(100, 100), locale, world_clock);
     Console.WriteLine("Adam spawned at: " + adam.world_clock.current_time);
     // give him some food
     Item mana = new Item("mana", 1000);
     adam.inventory.Add(mana);
     return adam;
 }
Пример #3
0
        // defines the object in the game and runs the game loop
        static void Main(string[] args)
        {
            bool game_on = true;

            // generate the world
            World locale = new World(100, 100);
            gametime world_clock = new gametime();
            Console.WriteLine("new clock: " + world_clock.current_time);

            // populate teh world with our test person
            Person adam=spawnAdam(locale,world_clock);

            // add him to the world
            locale.inhabitants.Add(adam);

            // the game loop
            while (game_on)
            {
                world_clock.tick(locale.inhabitants);
            }
        }
Пример #4
0
        private Animal owner; // a reference to the owner of this data

        #endregion Fields

        #region Constructors

        // establishing the initial rest data
        public RestData(Animal o, World w, gametime clock)
        {
            owner = o;
            max_rest=48;
            rest_drain = 1;
            over_rested_level=0.9;
            well_rested_level=0.7;
            rested_level=0.6;
            fatigued_level=0.5;
            sleepy_level=0.4;
            tired_level=0.3;
            restfulness = (int)(max_rest * (rested_level + ((well_rested_level - rested_level) / 2)));

            sleep_time = 0;
            rest_rate = 4;
            nocturnal = false;
            locale = w;
            world_clock = clock;
            calcRestState();
            //Console.WriteLine(owner+" rest data received time: " + world_clock.current_time);
        }
Пример #5
0
 public Person(string nm, Point start_location, World w, gametime clock)
     : base(nm, start_location, w, clock)
 {
     //rest_data = new RestData(this, w, clock);
     inventory = new List<Item>();
     Console.WriteLine("Initiating a person: " + world_clock.current_time);
 }
Пример #6
0
        // When a life form is created, we can chose its starting nutrition
        // and usualy, they start alive.
        public LifeForm(Point start_location, World w,gametime clock)
        {
            id = Program.generateID(); // need to develop a global system to determine IDs and reference objects by their IDs

            state = "alive";
            hungry = false;
            hunger_level = 0.5;
            max_sation = 96;
            burn_speed = 1;
            nutrition = 75;
            location = start_location;
            locale = w;
            action_queue=new Queue<Actionable>();
            inventory= new List<Item>();
            world_clock = clock;

            // debug feedback
            //Console.WriteLine("Lifeform created at coordinates "+location);
            //Console.Write("Nutrition: " + nutrition +"\n");
        }