public MineshaftMonsterSpawnChance(Type monsterType, MonsterInformation information, double spawnWeight, int minLevel, int maxLevel) { MonsterType = monsterType; Information = information; SpawnWeight = spawnWeight; MinLevel = minLevel; MaxLevel = maxLevel; }
/// <summary> /// Adds the chance for a given monster to spawn /// </summary> /// <param name="monsterType">Type of monster that will spawn</param> /// <param name="monsterInformation">Information of monster that will spawn</param> /// <param name="spawnWeight">Chance that this monster will spawn, the higher the number, the higher the chance, with 1 being the weight of the default monster</param> /// <param name="minLevel">earliest mineshaft level that this spawn chance applies</param> /// <param name="maxLevel">latest minehsaft level that this spawn chance applies</param> public static void AddMonsterSpawnChance(Type monsterType, MonsterInformation monsterInformation, double spawnWeight, int minLevel, int maxLevel) { // Create the new spawn chance data object MineshaftMonsterSpawnChance newSpawnChance = new MineshaftMonsterSpawnChance(monsterType, monsterInformation, spawnWeight, minLevel, maxLevel); // Add it to the MonsterSpawnChances list MonsterSpawnChances.Add(newSpawnChance); }
// Use this for initialization void Start() { minionMonster = new MonsterInformation(); minionMonster.basecharacterinformation = new BaseCharacterInformation(); minionMonster.basecharacterinformation.SetHP(10); minionMonster.basecharacterinformation.SetDamage(2); minionMonster.basecharacterinformation.SetPostion(new Vector3(Random.Range(-2.5f, 2.5f), 1.5f, Random.Range(-2.5f, 2.5f))); transform.position = minionMonster.basecharacterinformation.GetPostion(); drawBar = GameObject.Find("Canvas").GetComponent <DrawBar>(); }
protected void LoadMonsterInfo(string monsterName) { MonsterInformation info = new MonsterInformation(); if (monsterXmlDoc != null) { string UIsprite, gameName, dataName; float spawnTime, maxHealth, moveSpeed; int goldCost, maxAlive, experience; XmlNode node = monsterXmlDoc.SelectSingleNode("/monsters/monster[@name=\'" + monsterName + "\']"); UIsprite = node.SelectSingleNode("./UISprite").InnerText; gameName = node.SelectSingleNode("./gameName").InnerText; dataName = monsterName; spawnTime = float.Parse(node.SelectSingleNode("./stats").SelectSingleNode("./spawnTime").InnerText); goldCost = int.Parse(node.SelectSingleNode("./goldCost").InnerText); maxAlive = int.Parse(node.SelectSingleNode("./stats").SelectSingleNode("./maxAlive").InnerText); experience = int.Parse(node.SelectSingleNode("./experience").InnerText); maxHealth = float.Parse(node.SelectSingleNode("./stats").SelectSingleNode("./health").InnerText); moveSpeed = float.Parse(node.SelectSingleNode("./stats").SelectSingleNode("./moveSpeed").InnerText); info.UISpriteName = UIsprite; info.spawnTime = spawnTime; info.goldCost = goldCost; info.maxAlive = maxAlive; info.maxHealth = maxHealth; info.moveSpeed = moveSpeed; info.gameName = gameName; info.dataName = dataName; LoadActionInfo(info.actionInformation, node.SelectSingleNode("./action")); LoadActionModifierInfo(info.actionInformation, node.SelectSingleNode("./action").SelectSingleNode("./actionModifiers")); } cachedMonsterInformation.Add(monsterName, info); }
public TestMonster(MonsterInformation Information, Vector2 Position) : base(Information, Position) { }
protected void OnMonsterChosen(MonsterInformation info) { HideSelect(); if (info == null) { return; } monsterToSpawn = info; this.canBuild = false; this.canSpawn = true; this.canSell = true; this.maxSpawnedAtOnce = info.maxAlive; this.timeToSpawn = info.spawnTime; sprite.spriteId = sprite.GetSpriteIdByName(info.UISpriteName); sprite.color = Color.grey; PopulateIndicators(); }
public void AddMonster(MonsterInformation monsterInfo) { GameObject monsterButton = Instantiate(Resources.Load("MonsterButton")) as GameObject; tk2dSprite sprite = monsterButton.transform.FindChild("box").FindChild("sprite").GetComponent<tk2dSprite>(); sprite.spriteId = sprite.GetSpriteIdByName(monsterInfo.UISpriteName); monsterButton.GetComponentInChildren<UIButton>().data = monsterInfo.dataName; monsterScrollList.AddItem(monsterButton); }
protected void ShowMonsterStats(MonsterInformation monsterInfo) { statsPanel.BringIn(); magnitudeBar.Value = monsterInfo.actionInformation.magnitude / damageBarMaxValue; attackSpeedBar.Value = (attackSpeedBarMaxValue - monsterInfo.actionInformation.actionSpeed) / attackSpeedBarMaxValue; attackRangeBar.Value = monsterInfo.actionInformation.actionRange / attackRangeBarMaxValue; movementSpeedBar.Value = monsterInfo.moveSpeed / movementSpeedBarMaxValue; healthBar.Value = monsterInfo.maxAlive / healthBarMaxValue; spawnRate.Text = monsterInfo.spawnTime + "/" + monsterInfo.maxAlive; confirmButton.controlIsEnabled = true; confirmButtonImage.color = Color.white; goldCost.Text = monsterInfo.goldCost.ToString(); goldCost.Color = Color.green; monsterName.Text = monsterInfo.gameName; monsterName.SetAlignment(SpriteText.Alignment_Type.Center); monsterSprite.spriteId = monsterSprite.GetSpriteIdByName(monsterInfo.UISpriteName); //Push the attack modifier icons for (int i = 0; i < actionEffectIcons.Length && i < monsterInfo.actionInformation.actionModifierSpriteNames.Count; i++) { actionEffectIcons[i].spriteId = actionEffectIcons[i].GetSpriteIdByName(monsterInfo.actionInformation.actionModifierSpriteNames[i]); } //Make sure the player can purchase the monster, otherwise we'll disable the buy button. if (playerStatusManager.Gold < monsterInfo.goldCost) { goldCost.Color = Color.red; confirmButtonImage.color = Color.gray; confirmButton.controlIsEnabled = false; } }
public void OnMonsterChosen() { monsterChosen = true; monsterInfo = EntityFactory.GetInstance().GetMonsterInfo((string) monsterScrollList.LastClickedControl.Data); ShowMonsterStats(monsterInfo); }
public Monster(MonsterInformation Information, Vector2 Position) : base(Information.Name, Position) { this.Information = Information; }