Exemple #1
0
        public Citizen()
        {
            id = IDPREFIX + citizenNum;
            citizenNum++;
            int nameSelection = random.Next(1);

            if (nameSelection > 0)
            {
                name = "Jane";
            }
            else
            {
                name = "John";
            }
            age = random.Next(18, 65);
            citizenNum++;
            infected     = false;
            rebel        = false;
            happiness    = 50;
            hospitalized = false;
            dead         = false;
            wearingMask  = false;
            homeLocation = Game.town.Residential[random.Next(Game.town.Residential.Count - 1)];
            generateWorkLocation(random.Next(3));
            favoriteTask = new CitizenTask(random, this, true);
            currentTask  = new CitizenTask(random, this, false);
            generateCitizenRisk(random.Next(1), random.Next(1), random.Next(1), Game.GAME_MODIFIER);
        }
Exemple #2
0
        private void updateTask()
        {
            currentTask.Update(random, this);     // Updates citizen's task
            if (currentTask.Completed)
            {
                if (currentTask.Equals(favoriteTask))
                {
                    happiness += currentTask.calculateTaskHappiness(random, rebel, favoriteModifier);
                }
                else
                {
                    happiness += currentTask.calculateTaskHappiness(random, rebel, 1);
                }

                currentTask = new CitizenTask(random, this, false);     // Generates a new task that isn't a favorite
            }
        }
Exemple #3
0
 public void loadPreviousTask(int taskID, int startTime, int endTime, int startDay, int endDay, int completed, Building building)
 {
     currentTask = new CitizenTask(taskID, startTime, endTime, startDay, endDay, completed, building);
 }
Exemple #4
0
 private void loadFavoriteTask(int taskID, Building building)
 {
     favoriteTask = new CitizenTask(taskID, 0, 0, 0, 0, 0, building);     // Instantiated with Zeros since that data isn't important for loading the citizen's favorite task
 }
Exemple #5
0
        private void generateLastTask(CitizenData c)
        {
            bool   buildingFound = false;
            string taskLoc       = c.CurrentTaskLoc;

            for (int i = 0; i < Game.town.recreational.Count; i++)
            {
                if (Game.town.recreational[i].ID.Equals(taskLoc))
                {
                    int num = 0;
                    if (c.TaskCompleted)
                    {
                        num = 1;
                    }
                    currentTask   = new CitizenTask(c.CurrentTaskId, Game.town.Time, c.EndTime, Game.town.Day, c.EndDay, num, Game.town.recreational[i]);
                    buildingFound = true;
                }
            }
            if (!buildingFound)
            {
                for (int i = 0; i < Game.town.residential.Count; i++)
                {
                    if (Game.town.residential[i].ID.Equals(taskLoc))
                    {
                        int num = 0;
                        if (c.TaskCompleted)
                        {
                            num = 1;
                        }
                        currentTask   = new CitizenTask(c.CurrentTaskId, Game.town.Time, c.EndTime, Game.town.Day, c.EndDay, num, Game.town.residential[i]);
                        buildingFound = true;
                    }
                }
            }

            if (!buildingFound)
            {
                for (int i = 0; i < Game.town.essentials.Count; i++)
                {
                    if (Game.town.essentials[i].ID.Equals(taskLoc))
                    {
                        int num = 0;
                        if (c.TaskCompleted)
                        {
                            num = 1;
                        }
                        currentTask   = new CitizenTask(c.CurrentTaskId, Game.town.Time, c.EndTime, Game.town.Day, c.EndDay, num, Game.town.essentials[i]);
                        buildingFound = true;
                    }
                }
            }

            if (!buildingFound)
            {
                for (int i = 0; i < Game.town.emergency.Count; i++)
                {
                    if (Game.town.emergency[i].ID.Equals(taskLoc))
                    {
                        int num = 0;
                        if (c.TaskCompleted)
                        {
                            num = 1;
                        }
                        currentTask   = new CitizenTask(c.CurrentTaskId, Game.town.Time, c.EndTime, Game.town.Day, c.EndDay, num, Game.town.emergency[i]);
                        buildingFound = true;
                    }
                }
            }

            if (!buildingFound)
            {
                Debug.Log("This game sucks. Can't even load shit. It's like Detroit all over again");
            }
        }