// Use this for initialization void Awake() { if (vStatus != null) Destroy(this.gameObject); else vStatus = this; var villagers = FindObjectsOfType<CharMotor>(); foreach (var v in villagers) { if (v.gameObject.layer == LayerMask.NameToLayer("villager")) { villagerCount++; } } text = GetComponent<Text>(); }
// Use this for initialization void Awake() { if (vStatus != null) { Destroy(this.gameObject); } else { vStatus = this; } var villagers = FindObjectsOfType <CharMotor>(); foreach (var v in villagers) { if (v.gameObject.layer == LayerMask.NameToLayer("villager")) { villagerCount++; } } text = GetComponent <Text>(); }
public Village(VillageStartup startup, ServerCallContext context) { _context = context; _startup = startup; _year = 346; _month = 1; _status = new VillageStatus { Time = "", People = _startup.People, Message = "" }; _villagers = new List <Villager>(); for (int i = 0; i < startup.People; i++) { _villagers.Add(new Villager { IsMale = _r.Next(1) == 1, IsPregnant = false, Age = _r.Next(30), MonthBorn = _r.Next(1, 12) }); } }