// Start is called before the first frame update void Start() { this.items = new Item[3]; detector = GetComponentInChildren <SpotEnemy>(); this.actorType = NPC.ActorType.MOB; typesToTarget.Add(NPC.ActorType.COMPANION); typesToTarget.Add(NPC.ActorType.PLAYER); AttackAreaDamage temp = hitPoint.GetComponent <AttackAreaDamage>(); temp.damage = this.damage; //temp.typesToAttack = new string[2] { "Player", "Companion" }; // this.state = NPC.State.PATROL; this.SetState(new PatrolState(this.gameObject)); //if (this.type == NPCType.RANGED) //{ // projectile.GetComponent<Projectile>().typesToAttack.Add("Player"); // projectile.GetComponent<Projectile>().typesToAttack.Add("Companion"); //} // Randomly Create Weapons for (int i = 0; i < 2; ++i) { int itemIconMin = 0; int itemIconMax = 0; int attributeTypeMax = 3; int skillProjectileId = 0; int skillTypeMin = 0; int skillTypeMax = 0; int skillIcon = 0; int itemIcon; int attributeType; string baseName = "Weapon"; int skillType = 0; int wepType = Random.Range(0, 2); Random.Range(0, attributeTypeMax); attributeType = Random.Range(0, attributeTypeMax); GameManager.Pair skillProj = new GameManager.Pair(0, 0); switch (wepType) { case 0: itemIconMin = 6; itemIconMax = 12; skillTypeMin = 0; skillTypeMax = 1; baseName = "Sword"; break; case 1: itemIconMin = 0; itemIconMax = 5; skillTypeMin = 1; skillTypeMax = 3; baseName = "Bow"; break; default: break; } skillType = Random.Range(skillTypeMin, skillTypeMax); itemIcon = Random.Range(itemIconMin, itemIconMax); skillIcon = skillType; if (skillType > 0) { skillProjectileId = Random.Range(0, 2); } else { skillProjectileId = skillType; } itemIcon = Random.Range(itemIconMin, itemIconMax); items[i] = (GameManager.instance.weaponFactory.CreateWeapon(new WeaponFactory.WeaponEssentials((WeaponFactory.AttributeType)attributeType, (Weapon.ClassType)wepType, GameObjectContainers.instance.GetAttackEffect(0), 10, (Weapon.SkillClassType)skillType, GameObjectContainers.instance.GetAttackEffect(1), skillType > 0 ? GameObjectContainers.instance.GetArrowProjectile(skillProjectileId) : GameObjectContainers.instance.GetMagicProjectile(skillProjectileId), wepType == 1 ? GameObjectContainers.instance.GetArrowProjectile(0) : null, GameObjectContainers.instance.GetSkillIcon(skillIcon)), new ItemFactory.ItemEssentials(GameObjectContainers.instance.GetItemIcon(itemIcon), (int)(Random.Range(0f, 1f) * 30), GameManager.instance.currentLevel, baseName, 0, true, new Vector2(1, 1), true, Item.ItemType.WEAPON, null, null, Character.instance))); } items[2] = (GameManager.instance.potionFactory.CreatePotion(new PotionFactory.PotionEssentials(Potion.PotionType.HEALTH, 10 * GameManager.instance.currentLevel), new ItemFactory.ItemEssentials(GameObjectContainers.instance.GetPotionIcon(0), (int)(10 * GameManager.instance.currentLevel * 0.3f), GameManager.instance.currentLevel, "Health Potion", 1, false, new Vector2(1, 1), true, Item.ItemType.POTION, null, null, null))); }
public void ChangeContainerContent(int level) { this.items.Clear(); if (shopType == ShopType.WEAPON) { for (int i = 0; i < 28; ++i) { int itemIconMin = 0; int itemIconMax = 0; int attributeTypeMax = 3; int skillProjectileId = 0; int skillTypeMin = 0; int skillTypeMax = 0; int skillIcon = 0; int itemIcon; int attributeType; string baseName = "Weapon"; int skillType = 0; int wepType = Random.Range(0, 2); Random.Range(0, attributeTypeMax); attributeType = Random.Range(0, attributeTypeMax); GameManager.Pair skillProj = new GameManager.Pair(0, 0); switch (wepType) { case 0: itemIconMin = 6; itemIconMax = 12; skillTypeMin = 0; skillTypeMax = 1; baseName = "Sword"; break; case 1: itemIconMin = 0; itemIconMax = 5; skillTypeMin = 1; skillTypeMax = 3; baseName = "Bow"; break; default: break; } skillType = Random.Range(skillTypeMin, skillTypeMax); itemIcon = Random.Range(itemIconMin, itemIconMax); skillIcon = skillType; if (skillType > 0) { skillProjectileId = Random.Range(0, 2); } else { skillProjectileId = skillType; } itemIcon = Random.Range(itemIconMin, itemIconMax); items.Add(GameManager.instance.weaponFactory.CreateWeapon(new WeaponFactory.WeaponEssentials((WeaponFactory.AttributeType)attributeType, (Weapon.ClassType)wepType, GameObjectContainers.instance.GetAttackEffect(0), 10, (Weapon.SkillClassType)skillType, GameObjectContainers.instance.GetAttackEffect(1), skillType > 0 ? GameObjectContainers.instance.GetArrowProjectile(skillProjectileId) : GameObjectContainers.instance.GetMagicProjectile(skillProjectileId), wepType == 1 ? GameObjectContainers.instance.GetArrowProjectile(0) : null, GameObjectContainers.instance.GetSkillIcon(skillIcon)), new ItemFactory.ItemEssentials(GameObjectContainers.instance.GetItemIcon(itemIcon), 30, GameManager.instance.currentLevel, baseName, 0, true, new Vector2(1, 1), true, Item.ItemType.WEAPON, testRenderableForm, null, Character.instance))); } } else if (shopType == ShopType.POTION) { for (int i = 0; i < 1; ++i) { items.Add(GameManager.instance.potionFactory.CreatePotion(new PotionFactory.PotionEssentials(Potion.PotionType.HEALTH, 10 * GameManager.instance.currentLevel), new ItemFactory.ItemEssentials(GameObjectContainers.instance.GetPotionIcon(0), (int)(10 * GameManager.instance.currentLevel * 0.3f), GameManager.instance.currentLevel, "Health Potion", 1, false, new Vector2(1, 1), true, Item.ItemType.POTION, null, null, null))); } } else if (shopType == ShopType.ARMOR) { for (int i = 0; i < 28; ++i) { int tp = Random.Range(1, 4); int icon = 0; string baseName = ""; switch (tp) { case 1: icon = Random.Range(0, 5); baseName = "Legs"; break; case 2: icon = Random.Range(5, 10); baseName = "Chest Armor"; break; case 3: icon = Random.Range(10, 15); baseName = "Helmet"; break; default: break; } items.Add(GameManager.instance.armorFactory.CreateArmor(new ArmorFactory.ArmorEssentials((Armor.ClassType)tp), new ItemFactory.ItemEssentials(GameObjectContainers.instance.GetArmorIcon(icon), (int)(20 * GameManager.instance.currentLevel * 0.2f), GameManager.instance.currentLevel, baseName, 1, true, new Vector2(1, 1), true, Item.ItemType.ARMOR, null, null, null))); } } }