void Start() { var visitorInfos = SdbInstance <Sdb.VisitorInfo> .GetAll(); var selectedInfo = Constants.RaceType.Asmodian_W; //visitorInfos[Random.Range(0, visitorInfos.Count)]; Logic.Visitor newVisitor = Logic.VisitorFactory.Instance.Create(selectedInfo); newVisitor.MoveToCounter(Logic.VisitorFactory.Instance.CounterPosition); }
private void CreateVisitor() { var visitorInfos = SdbInstance <Sdb.VisitorInfo> .GetAll(); var selectedInfo = visitorInfos[Random.Range(0, visitorInfos.Count)]; Visitor newVisitor = VisitorFactory.Instance.Create(selectedInfo.RaceType); newVisitor.MoveToCounter(VisitorFactory.Instance.CounterPosition); IsVisitorProcessed = false; currentVisitor = newVisitor; rooms.SetActive(true); doorAnimator.Play("OpenAndClose"); SfxManager.Instance.Play(SfxType.Walk); UI.SelectMessage.Instance.Show(0); OnVisitorCreated?.Invoke(currentVisitor); }
private string GetRandomWeaponId() { // 50, 30, 20 List <Sdb.WeaponInfo> weaponInfos = SdbInstance <Sdb.WeaponInfo> .GetAll(); Dictionary <Constants.WeaponGrade, List <Sdb.WeaponInfo> > infoByGrade = new Dictionary <Constants.WeaponGrade, List <Sdb.WeaponInfo> >(); for (int i = 0; i < weaponInfos.Count; ++i) { if (infoByGrade.ContainsKey(weaponInfos[i].Grade) == false) { infoByGrade.Add(weaponInfos[i].Grade, new List <Sdb.WeaponInfo>()); } infoByGrade[weaponInfos[i].Grade].Add(weaponInfos[i]); } infoByGrade[Constants.WeaponGrade.Low].Remove(SdbInstance <Sdb.WeaponInfo> .Get("Basic_Weapon")); float random = Random.value; Constants.WeaponGrade selectedGrade = Constants.WeaponGrade.Undefined; if (random > 0.8f) { selectedGrade = Constants.WeaponGrade.High; } else if (random > 0.5f) { selectedGrade = Constants.WeaponGrade.Normal; } else { selectedGrade = Constants.WeaponGrade.Low; } int gradeWeaponsCount = infoByGrade[selectedGrade].Count; return(infoByGrade[selectedGrade][Random.Range(0, gradeWeaponsCount)].Id); }