public Project(string title, string company, string description, int length, ProjectDifficulty difficulty, int minWorkers) { this.title = title; this.company = company; this.description = description; this.length = length; this.difficulty = difficulty; this.minWorkers = minWorkers; }
// Updates the project menu void UpdateProjectMenu(string project) { ProjectDifficulty difficulty = projects[SelectedProject].getDifficulty(); projects.Remove(project); // Check if finished all projects of the same difficulty var finishedAllDifficulty = true; foreach (var entry in projects) { if (entry.Value.getDifficulty() == difficulty) { finishedAllDifficulty = false; } } // Unlock next difficulty level if (finishedAllDifficulty) { var keys = new List <string>(projects.Keys); foreach (var entry in keys) { var unlockedProject = projects[entry]; // Unlock all easy levels if (difficulty == ProjectDifficulty.Tutorial && unlockedProject.getDifficulty() == ProjectDifficulty.Easy) { unlockedProject.setEnabled(true); projects[entry] = unlockedProject; } // Unlock all medium levels if (difficulty == ProjectDifficulty.Easy && unlockedProject.getDifficulty() == ProjectDifficulty.Medium) { unlockedProject.setEnabled(true); projects[entry] = unlockedProject; } // Unlock all hard levels if (difficulty == ProjectDifficulty.Medium && unlockedProject.getDifficulty() == ProjectDifficulty.Hard) { unlockedProject.setEnabled(true); projects[entry] = unlockedProject; } } } }
// Set up timer void OnEnable() { // Show the progress bar progressScript = GetComponent <ProjectManager> (); currentProject = progressScript.GetCurrentProject(); progressPanel.SetActive(true); paused = false; // Set the timer length depending on project length maxTime = currentProject.getLength() * timeMultiplier; Debug.Log("Max Time: " + maxTime); timer = maxTime; progressBar.value = 0; // initialise bug variables bugsSquashed = 0; bugsCreated = 0; // adjust number of bugs that will show based on difficulty of project ProjectDifficulty difficulty = currentProject.getDifficulty(); if (difficulty == ProjectDifficulty.Tutorial) { bugProbability = 0; // no bugs on first level } else if (difficulty == ProjectDifficulty.Easy) { bugProbability = 0.005f; } else if (difficulty == ProjectDifficulty.Medium) { bugProbability = 0.0075f; } else { bugProbability = 0.01f; } }
public void setDifficulty(ProjectDifficulty difficulty) { this.difficulty = difficulty; }
public Project(ProjectDifficulty difficulty, string name, BuildingShape building) { Difficulty = difficulty; Name = name; Building = building; }