void SetRndProbs(HumanProperties probs) { //TODO: macht nicht viel Sinn oder? Sprit muss angepasst werden probs.sex = RandomInt(0, 1) == 0 ? SexEnum.male : SexEnum.female; probs.age = Random.Range(5, 99); probs.status = HealthStatusEnum.healthy; }
public HumanProperties SpawnObject(GameObject preFab) { Vector2 pos = new Vector2(Random.Range(-maxRangeX / 2, maxRangeX / 2) + transform.position.x, Random.Range(-maxRangeY / 2, maxRangeY / 2) + transform.position.y); GameObject h = GameObject.Instantiate(preFab); h.transform.position = pos; HumanProperties probs = h.GetComponent <HumanProperties>(); return(probs); }
public static bool TrySelectNewCharacter(HumanProperties vHumanProperties) { if (SelectedCharacter == null) { SelectedCharacter = vHumanProperties; return(true); } else { return(false); } }
void Start() { SetSpeed(normalSpeed); //Calc init move dir calcDir(Random.Range(0, 360)); myProbs = GetComponent <HumanProperties>(); Highlighter.SetActive(false); DirectionArrow.SetActive(false); InvokeRepeating("NewRandomDirection", 2.0f, RandomDirectionCycleTime); }
public void AddNewInfected(HumanProperties human) { if (isGameOver) { return; } //check if already counted if (infectedHumans.Contains(human)) { return; } Debug.Log("New!"); infectedHumans.Add(human); CheckLost(); }
// Start is called before the first frame update void Start() { List <HumanProperties> allHumans = new List <HumanProperties>(); for (int i = 0; i < count; i++) { GameObject preFab = humans[RandomInt(0, humans.Count)]; SpawnPoint point = spawnPoints[RandomInt(0, spawnPoints.Count)]; HumanProperties probs = point.SpawnObject(preFab); SetRndProbs(probs); allHumans.Add(probs); } //failsave - need min 1 infected InfectionManager.Instance.setAllHumans(allHumans); if (InfectionManager.Instance.infectedHumans.Count <= startInfected) { for (int i = 0; i < startInfected; i++) { allHumans[i].Infect(); //infect } } }
public Human() { Properties = new HumanProperties(); }
public void addHuman(HumanProperties newHuman) { allHumans.Add(newHuman); }
public static void DeselectCharacter() { SelectedCharacter = null; }