public object OnToSwipeScene(bool result) { var tmpRace = "Human"; _playerCharacter = RacesData.GetCharacterFromRaceAndLevel(_race, 1, true); if (_playerCharacter.Gender != CharacterGender.Transgender) { _playerCharacter.Gender = _gender; } _playerCharacter.Name = _characterName.text; for (int i = 0; i < _skinContainer.transform.childCount; ++i) { var child = _skinContainer.transform.GetChild(i); var childSpriteRenderer = child.GetComponent <SpriteRenderer>(); for (int y = 0; y < _playerCharacter.BodyParts.Count; ++y) { if (RacesData.BodyParts[y].Contains(child.name)) { var skinPath = "Sprites/" + tmpRace + "/" + childSpriteRenderer.sprite.name; _playerCharacter.BodyParts[y] = skinPath; } } } Journey = new Journey(_playerCharacter); PlayerPrefsHelper.SaveJourney(Journey); PlayerPrefsHelper.SaveCharacter(Constants.PpPlayer, _playerCharacter); NavigationService.LoadNextScene(Constants.SwipeScene); return(result); }
private void RandomizeAll() { foreach (var button in _leftButtons) { if (!IsTopButtons(button.name)) { continue; } int maxRand = RacesData.NbSkinTemplates; if (button.gameObject.name.Contains("Gender")) { maxRand = 2; } else if (button.gameObject.name.Contains("Race")) { maxRand = Helper.EnumCount <CharacterRace>(); } var max = Random.Range(0, maxRand); for (int i = 0; i < max; ++i) { Constants.SetLastEndActionClickedName(button.name); button.EndActionDelegate.Invoke(); } } _characterName.text = RacesData.GetRandomNameFromRaceAndGender(_race, _gender); RandomizeSkin(); }
protected override void SetPrivates() { base.SetPrivates(); CanGoPreviousScene = false; Soul = PlayerPrefsHelper.GetSoul(); _nbCharChoice = Soul.GetStatCurrentValue(Soul.SoulStats[Soul.NbCharChoice_Id]); _choices = new List <Character>(); var maxStartingLevel = Soul.GetStatCurrentValue(Soul.SoulStats[Soul.StartingLevel_Id]); var minStartingLevel = maxStartingLevel - 2 > 1 ? maxStartingLevel - 2 : 1; for (int i = 0; i < _nbCharChoice; ++i) { var tmpChoice = RacesData.GetCharacterFromRaceAndLevel((CharacterRace)Random.Range(0, Helper.EnumCount <CharacterRace>()), Random.Range(minStartingLevel, maxStartingLevel + 1), isPlayer: true); tmpChoice.RunAwayPercent += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.RunAwayPercent_Id]); tmpChoice.LootPercent += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.LootPercent_Id]); tmpChoice.CritChancePercent += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.CritChance_Id]); tmpChoice.InventoryPlace += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.InvPlace_Id]); tmpChoice.InventoryPlace = tmpChoice.InventoryPlace > 6 ? 6 : tmpChoice.InventoryPlace; tmpChoice.WeightLimit += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.InvWeight_Id]); tmpChoice.Gold += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.Gold_Id]); tmpChoice.HpMax += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.Health_Id]); tmpChoice.Hp = Helper.RandomIntMultipleOf(tmpChoice.HpMax / 2, tmpChoice.HpMax, 10); tmpChoice.PmMax += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.Pm_Id]); tmpChoice.PaMax += Soul.GetStatCurrentValue(Soul.SoulStats[Soul.Pa_Id]); _choices.Add(tmpChoice); } Soul.XpKept = (int)(Soul.Xp * Helper.MultiplierFromPercent(0, Soul.GetStatCurrentValue(Soul.SoulStats[Soul.XpKeptPercent_Id]))); Soul.Xp = 0; _skinContainerBhv = GameObject.Find("SkinContainer").GetComponent <SkinContainerBhv>(); _choiceSelector = GameObject.Find("ChoiceSelector"); _characterFrame = GameObject.Find("CharacterFrame"); _playerChoice = _choices[0]; }
public List <Race> GetAll() { List <Race> races = new List <Race>(); RacesData rData = new RacesData(CurrentDataContext); races = rData.GetAll(); return(races); }
public Race AddRace(Race newRace) { // Add race RacesData raceData = new RacesData(CurrentDataContext); newRace.Id = raceData.AddRace(newRace); RacePowersData powersData = new RacePowersData(CurrentDataContext); foreach (RacePower power in newRace.RacePowers) { power.RaceId = newRace.Id; power.Id = powersData.AddPower(power); } return(newRace); }
public Race EditRace(Race race) { RacesData raceData = new RacesData(CurrentDataContext); raceData.UpdateRace(race); RacePowersData powersData = new RacePowersData(CurrentDataContext); foreach (RacePower power in race.RacePowers) { if (power.Id == 0) { power.RaceId = race.Id; power.Id = powersData.AddPower(power); } else { powersData.UpdatePower(power); } } return(race); }
public void DeleteClassById(int id) { RacesData raceData = new RacesData(CurrentDataContext); raceData.DeleteRaceById(id); }