public void UpdateMonsterDisplay() { if ((sprite = Resources.Load("UI/avatar/" + type.ToString(), typeof(Sprite)) as Sprite) != null) { image.sprite = sprite; } else if ((sprite = Resources.Load("UI/avatar/" + type.ToString() + "5", typeof(Sprite)) as Sprite) != null) { image.sprite = sprite; } }
public bool InitMonsterData(ref Monster monster, int unlocklevel, MonsterType type, int level) { if (monster == null) { return(false); } CharacterData data = GetMonsterData(unlocklevel, type.ToString(), level); monster.InitializeMonster(type, type.ToString(), level, data.attack, data.magicAttack, data.defense, data.magicDefense, data.HP, data.dexterity, data.attackRange); return(true); }
public void Awaken() { if (isBoss) { monsterName = monsterType.ToString(); this.sprite = Resources.Load <Sprite>($"BossTokens/{monsterName}"); this.maxNumber = 1; } else { if (monsterType == MonsterType.None) { Debug.LogWarning("Missing Monster Type"); return; } if (!maxNumbers.ContainsKey(monsterType)) { Debug.LogWarning($"Missing Max Number: {monsterType}"); return; } monsterName = GetName(monsterType); var horzOrVert = isHorizontal ? "Horz-" : "Vert-"; this.sprite = Resources.Load <Sprite>($"MonsterTokens/{horzOrVert}{monsterName}"); this.maxNumber = maxNumbers[monsterType]; } //Debug.Log($"{monsterName}: max {maxNumber}"); this.GetComponentInChildren <SpriteRenderer>().sprite = sprite; this.GetComponentInChildren <TextMeshProUGUI>().color = isElite ? Color.yellow : Color.white; currentPosition = transform.position; }
public void OnMonsterButton() { for (int i = 0; i < SpawnableMonsters.Count; i++) { MonsterDisplay monster = content.transform.GetChild(i).GetComponent <MonsterDisplay>(); monster.gameObject.GetComponent <Image>().color = monster.type != currentType?Color.white:color; } name.text = currentType.ToString(); monsterSpawnPanel.UpdateSpawnPanel(); }
public MonsterData(MonsterDescription description, List <SkillData> skills, int level) { Id = Guid.NewGuid().ToString(); CombatData = new CombatData(Id, skills) { MaxHp = description.MaxHp, Level = level, UnitName = MonsterType.ToString() }; }
/// <summary> /// Instantiates a player. /// </summary> /// <param name="playerID">Player Identifier.</param> /// <param name="monster">Monster.</param> /// <param name="controllerType">Controller type.</param> /// <param name="controllerNumber">Controller number.</param> public void InstantiatePlayer(string playerID, MonsterType monster, ControlType controllerType, int controllerNumber) { // Instantiate monster prefab GameObject go = Instantiate (Resources.Load ("Prefabs/" + monster.ToString())) as GameObject; APlayer player = go.GetComponent<APlayer> (); player.Logic = this; player.PlayerID = playerID; player.ControllerType = controllerType; player.ControllerNumber = controllerNumber; _players.Add (player); }
private void SerializeLevelFromXML(int levelId, string levelPath, XmlReader reader, Level level) { var serializer = new XmlSerializer(typeof(XMLLevel)); if (level == null) { level = new Level(); } XMLLevel xmlLevel = serializer.Deserialize(reader) as XMLLevel; level.levelId = levelId; level.lettersGroup = xmlLevel.LettersGroup; level.monsterInputType = xmlLevel.monsterInputType; level.hideCallout = xmlLevel.HideCallout; level.shuffleSegment = xmlLevel.ShuffleSegment; level.SegmentTime = (xmlLevel.SegmentTime > 0f) ? xmlLevel.SegmentTime : GameplaySettings.CountdownDefault; level.StoneType = xmlLevel.StoneType; if (!string.IsNullOrEmpty(xmlLevel.CollectableMonster)) { if (Enum.IsDefined(typeof(MonsterType), xmlLevel.CollectableMonster)) { MonsterType type = (MonsterType)Enum.Parse(typeof(MonsterType), xmlLevel.CollectableMonster, true); level.CollectableMonster = Resources.Load("Gameplay/Monsters/" + type.ToString()) as Monster; } } level.Segments = xmlLevel.Segments; int maxPointsInLevel = 0; if (level.monsterInputType == MonsterInputType.Letter || level.monsterInputType == MonsterInputType.LetterInWord || level.monsterInputType == MonsterInputType.SoundLetter) { maxPointsInLevel = calcLetterMaxScore(level); } else { maxPointsInLevel = calcWordMaxScore(level); } LevelMaxScore += "Level: " + levelId + ", FileName: " + levelPath + ", Max Points: " + maxPointsInLevel.ToString() + "\n"; /* * if ( xmlLevel.Recognitions != null) { * GameplayController.Instance.Recognitions = xmlLevel.Recognitions; * } */ // Level templete = Resources.Load ("Gameplay/LevelTempletes/LevelTempleteBlueSky") as Level; // if (templete != null) { level.LoadTemplete(GameplayController.Instance.DefaultLevelTempletes); // } Debug.Log("LoadLevel" + levelPath); }
public override string ToString() { string ret = "name: " + this.eventName + "\ndescription: " + this.eventDescription + "\ncounter: " + this.counter + "\nOptions: " + "\nMonster: " + monsterType.ToString() + "\nLevel: " + level; foreach (GameEventOption option in options) { ret += option.ToString(); } return(ret); }
/// <summary> /// Get prettified string representation of a <c>MonsterType</c>. /// </summary> /// <param name="mt"></param> /// <returns> /// String representation of a <c>MonsterType</c>. /// </returns> public static string GetString(this MonsterType mt) { // Get name of MonsterType as string // See: https://stackoverflow.com/a/31742218/12347616 // And: https://stackoverflow.com/a/309339/12347616 var name = mt.ToString(); // Prettify it (e.g. SpaceMarine => Space Marine // See: https://stackoverflow.com/a/36147193/12347616 // And: https://stackoverflow.com/a/37262742/12347616 var prettified = string.Join(" ", Regex.Split(name, @"(?<!^)(?=[A-Z])")); return(prettified ?? name); }
public void InitializeMonster(MonsterType monsterType, string name, int level, int attack, int magicAttack, int defense, int magicDefense, int HP, int dexterity, int attackRange) { this.monsterType = monsterType; Name = monsterType.ToString(); InitializePawn(PawnType.Monster, name, level, attack, magicAttack, defense, magicDefense, HP, dexterity, attackRange); defaultSkill = 1; equippedSkill = 3; skillsAndPassives = new Dictionary <int, string>(); ReadSkillNames(this); CanDoAction = true; remainedStep = dexterity; actionType = ActionType.Actionable; gm = FindObjectOfType <GameManager>(); pawnAction = gm.gameInteraction.pawnActionPanel; }
public void UpdateCurrentMonster() { if (characterReader == null) { characterReader = GameObject.FindObjectOfType <GameManager>().GetComponent <GameManager>().characterReader; } string name = type.ToString(); skilldata = characterReader.GetMonsterSkillUI(name); description = characterReader.GetCharacterDescription(PawnType.Monster, name); txtname.text = name; string skilltext = ""; for (int i = 0; i < 5; i++) { var strb = new System.Text.StringBuilder(skilldata[i].description); for (int j = 0; skilldata[i].description.Length - 18 * j > 18; j++) { strb.Insert(25 * j + 18, "\n\u3000\u3000\u3000\u3000\u3000\u3000"); } skilldata[i].description = strb.ToString(); skilltext += skilldata[i].name.PadRight(6, '\u3000') + skilldata[i].description + "\n"; } skill.text = skilltext; race.text = description.race; story.text = description.story; desc.text = description.description; if ((sprite = Resources.Load("Image/character/" + name, typeof(Sprite)) as Sprite) != null) { image.sprite = sprite; } else if ((sprite = Resources.Load("Image/character/" + name + "5", typeof(Sprite)) as Sprite) != null) { image.sprite = sprite; } }
private bool CardTypeForTradeIsOk(string offeredCardName, string requiredCardType) { if (requiredCardType.IsNullOrWhiteSpace() || requiredCardType.ToLower() == "any") { return(true); } CardType offeredCardType = CardsManager.ExtractCardType(offeredCardName); if (offeredCardType.ToString().ToLower() == requiredCardType.ToLower()) { return(true); } if (requiredCardType.ToLower() == "monster") { return(offeredCardType == CardType.Monster); } MonsterType monsterType = CardsManager.ExtractMonsterType(offeredCardName); return(requiredCardType.ToLower() == monsterType.ToString().ToLower()); }
public void UpdatePreview(MonsterType type) { name = type.ToString(); skilldata = characterReader.GetMonsterSkillUI(name); characterData = characterReader.GetMonsterData(gameManager.monsterManager.GetMonsterUnlockLevel(type), type.ToString(), 1); txtname.text = name; string skilltext = ""; var strb = new System.Text.StringBuilder(skilldata[0].description); for (int j = 0; skilldata[0].description.Length - letterPerLine * j > letterPerLine; j++) { strb.Insert((7 + letterPerLine) * j + letterPerLine, "\n\u3000\u3000\u3000\u3000\u3000\u3000"); } skilldata[0].description = strb.ToString(); skilltext += skilldata[0].name.PadRight(6, '\u3000') + skilldata[0].description + "\n"; skill.text = "<size=22>" + skilltext + "</size>"; data1.text = "1\n" + (characterData.HP) + "\n" + (characterData.attack) + "\n" + (characterData.defense) + "\n"; data2.text = (characterData.dexterity) + "\n" + (characterData.magicAttack) + "\n" + (characterData.magicDefense) + "\n" + (characterData.attackRange) + "\n"; if ((sprite = Resources.Load("Image/character/" + name, typeof(Sprite)) as Sprite) != null) { image.sprite = sprite; } else if ((sprite = Resources.Load("Image/character/" + name + "1", typeof(Sprite)) as Sprite) != null) { image.sprite = sprite; } }
public Monster(Game game, int x, int y, MonsterType type) : base(type.ToString(), x, y) { this.game = game; Type = type; switch (type) { case MonsterType.Skeleton: Health = 110; Damage = 110; break; case MonsterType.Zombie: Health = 150; Damage = 75; break; case MonsterType.Minotaur: Health = 250; Damage = 180; break; } }
public void UpdateBtn() { this.GetComponent <Text>().text = "-" + type.ToString() + "-"; }
private static Sprite AddTypeIcon(Image icon, MonsterType type) => icon.sprite = GetSprite(BADGES + TYPES + type.ToString().ToLower());
public ModelMonsterData GetMonsterData(MonsterType type) { if (!m_dicMonsterData.ContainsKey(type)) { DebugTool.LogError(string.Format("MMonsterData::GetAttackRoleData not exit type \"{0}\" data", type.ToString())); } return(m_dicMonsterData[type]); }
public static string GetName(MonsterType monsterType) { return(string.Join(" ", Regex.Split(monsterType.ToString(), @"(?<!^)(?=[A-Z])"))); }