public CharacterDescription GetCharacterDescription(PawnType type, string name) { CharacterDescription data = new CharacterDescription(); string xpath = ""; XmlElement node = null; if (type == PawnType.Monster) { xpath = "/character/monster//" + name; node = (XmlElement)xmlDocDescription.SelectSingleNode(xpath); } else if (type == PawnType.Enemy) { xpath = "/character/enemy//" + name; node = (XmlElement)xmlDocDescription.SelectSingleNode(xpath); } if (node == null) { Debug.Log("On CharacterReader GetCharacterDescription: " + name + " not found"); return(null); } data.race = (node["race"].InnerXml); data.story = (node["story"].InnerXml); data.description = (node["description"].InnerXml); return(data); }
void Start() { indexPlayer1 = 0; indexPlayer2 = 0; player1 = GetCharacterDescription(indexPlayer1); player2 = GetCharacterDescription(indexPlayer2); }
//grabs all relevent UI components on children void SetUI() { GameObject heightholder = transform.GetChild(0).gameObject; _heightText = heightholder.transform.GetChild(0).GetComponent <Text>(); _timeline = transform.GetChild(1).gameObject; _timeRef = _timeline.GetComponent <BattleTimeLine>(); _timeRef.Init(this); _shortHolder = transform.GetChild(2).gameObject; _shortPort = _shortHolder.transform.GetChild(0).GetComponent <Image>(); _shortHealth = _shortHolder.transform.GetChild(1).GetComponent <Text>(); _shortMana = _shortHolder.transform.GetChild(2).GetComponent <Text>(); _shortHolder.SetActive(false); _optionsRef = transform.GetChild(3).GetComponent <CharacterOptions>(); _optionsRef.Init(); _detailHolder = transform.GetChild(4).GetComponent <CharacterDescription>(); _detailHolder.Init(); _endingHolder = transform.GetChild(5).GetComponent <BattleEnding>(); _endingHolder.Init(); _initialized = true; _timeRef.ContinueFight(); }
public CharacterData(string playerName, CharacterDescription description) { PlayerName = playerName; if (description != null) { Type = description.CharacterType; } }
/// <summary> Create and initialisation character </summary> /// <param name="spawnPoint"> Spawn character position </param> /// <param name="description"> Character description</param> public static Character CreateCharacter(Vector3 spawnPoint, CharacterDescription description) { var newCharacter = Instantiate(description.CharacterPrefab); newCharacter.transform.position = spawnPoint; newCharacter.InitCharacter(description); return(newCharacter); }
/// <summary> Initialisation character after start </summary> /// <param name="description"> Character description</param> private void InitCharacter(CharacterDescription description) { Description = description; Health = Description.MaxHealth; RB = GetComponent <Rigidbody2D>(); Animator = GetComponent <Animator>(); SelectedWeapon = new WeaponEntity(this, Description.StartedWeapon); SelectedWeapon.CartridgesTotal = SelectedWeapon.Weapon.MaxCartridges; Weapons.Add(SelectedWeapon); if (RB == null) { Debug.LogError("RigidBody2D not found", this); } if (Animator == null) { Debug.LogError("Animator not found", this); } Animator.runtimeAnimatorController = Description.Animator; //Set hands if (FirstShoulder) { FirstShoulder.sprite = Description.FirstShoulder; } if (FirstForearm) { FirstForearm.sprite = Description.FirstForearm; } if (FirstForearmOutline) { FirstForearmOutline.sprite = Description.FirstForearmOutline; } if (SecondShoulder) { SecondShoulder.sprite = Description.SecondShoulder; } if (SecondForearm) { SecondForearm.sprite = Description.SecondForearm; } if (SecondForearmOutline) { SecondForearmOutline.sprite = Description.SecondForearmOutline; } //Set head if (HeadTransform) { HeadTransform.sprite = Description.HeadSprite; } }
public void PreviousCharacter(ref int index, ref CharacterDescription player) { if (index == 0) { index = charactersList.Length - 1; } else { index--; } player = GetCharacterDescription(index); }
public void NextCharacter(ref int index, ref CharacterDescription player) { if (index == (charactersList.Length - 1)) { index = 0; } else { index++; } player = GetCharacterDescription(index); }
public async Task <bool> DeleteDescription(int id) { CharacterDescription characterDescription = await _unitOfWork.CharacterRepository.GetCharacterDescription(id); _unitOfWork.CharacterRepository.Delete <CharacterDescription>(characterDescription); if (await _unitOfWork.CharacterRepository.SaveAll()) { return(true); } return(false); }
public async Task <CharacterDescriptionForScriptDto> CreateDescription(CharacterDescriptionForScriptDto entity) { if (entity.Title.Length > 20) { entity.Title = entity.Title.Remove(20); } CharacterDescription characterDescription = _mapper.Map <CharacterDescription>(entity); _unitOfWork.CharacterRepository.Add <CharacterDescription>(characterDescription); await _unitOfWork.CharacterRepository.SaveAll(); entity.Id = characterDescription.Id; return(entity); }
public override Dictionary <string, object> SaveToDict() { var dict = new Dictionary <string, object>(); dict.Add(GDMConstants.SchemaKey, "Characters"); dict.Merge(true, HealthPoints.ToGDEDict(HealthPointsKey)); dict.Merge(true, Experience.ToGDEDict(ExperienceKey)); dict.Merge(true, Level.ToGDEDict(LevelKey)); dict.Merge(true, BasicMelee.ToGDEDict(BasicMeleeKey)); dict.Merge(true, BasicDistance.ToGDEDict(BasicDistanceKey)); dict.Merge(true, BasicMagic.ToGDEDict(BasicMagicKey)); dict.Merge(true, CharacterName.ToGDEDict(CharacterNameKey)); dict.Merge(true, CharacterDescription.ToGDEDict(CharacterDescriptionKey)); dict.Merge(true, DifficultyLevel.ToGDEDict(DifficultyLevelKey)); return(dict); }
public TalentBundle CreateNewBundle(CharacterDescription characterDescription) { TalentBundle bundle = new TalentBundle(); List <List <TalentId> > rows = characterDescription.Talents; foreach (List <TalentId> row in rows) { var talents = new List <TalentData>(); foreach (TalentId talentId in row) { var description = storage[talentId]; var data = new TalentData(description); talents.Add(data); } bundle.TalentRows.Add(talents); } return(bundle); }
public CharacterData CreateNewCharacter(string playerName, CharacterDescription characterDescription) { CharacterData data = new CharacterData(playerName, characterDescription); return(data); }