Beispiel #1
0
 public Human(string _name)
 {
     name        = _name;
     hunger      = new DepletableObject(MAX_hunger, MAX_hunger, hunger_gain, hunger_drain, true);
     thirst      = new DepletableObject(MAX_thirst, MAX_thirst, thirst_gain, thirst_drain, true);
     health      = new DepletableObject(MAX_health, MAX_health, health_gain, health_drain, true);
     role        = HumanRole.resident;
     isInPrison  = false;
     isAlive     = true;
     isAliveSync = new object();
 }
Beispiel #2
0
        public Human()
        {
            List <string> rnd_names = new List <string>(new string[] { "John", "Jack", "Emily", "Janet" });
            Random        rnd       = new Random();

            name        = rnd_names[rnd.Next(rnd_names.Count)];
            hunger      = new DepletableObject(MAX_hunger, MAX_hunger, hunger_gain, hunger_drain, true);
            thirst      = new DepletableObject(MAX_thirst, MAX_thirst, thirst_gain, thirst_drain, true);
            health      = new DepletableObject(MAX_health, MAX_health, health_gain, health_drain, true);
            role        = HumanRole.resident;
            isInPrison  = false;
            isAlive     = true;
            isAliveSync = new object();
        }
        public void deleteHuman(HumanRole role, int i)
        {
            if (role == HumanRole.feudal)
            {
                return;
            }
            int index = 0;

            switch (role)
            {
            case HumanRole.resident: index = residents_amount; residents_amount--; break;

            case HumanRole.servant: index = residents_amount + servants_amount; servants_amount--; break;

            case HumanRole.guardian: index = residents_amount + servants_amount + warriors_amount; warriors_amount--; break;
            }
            index--;
            if (index < 0)
            {
                return;
            }
            people.RemoveAt(index);
        }
        private void startNewLiving(HumanRole role)
        {
            if (role == HumanRole.feudal)
            {
                return;
            }
            int index = 0;

            switch (role)
            {
            case HumanRole.resident: index = residents_amount; break;

            case HumanRole.servant: index = residents_amount + servants_amount; break;

            case HumanRole.guardian: index = residents_amount + servants_amount + warriors_amount; break;
            }
            index--;
            if (index < 0)
            {
                return;
            }
            people[index].live();
        }
Beispiel #5
0
 public void setRole(HumanRole _role)
 {
     role = _role;
 }