Beispiel #1
0
	float HurtEnemy(float Damage, WeaponExtras extra)
	{
		float damage = 0;
		foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("Enemy"))
		{
			if (enemy.GetComponent<Enemy>().IsNextToPlayer)
			{
				damage = (float)Math.Round(new FloatRange(0, Damage).Random, 2);

				// Carry out the extra function of the item if it has one.
				if (extra != null)
				{
					extra(this.Type, enemy.GetComponent<Enemy>());
				}

				// Decrease enemy health and create damage label.
				enemy.GetComponent<Enemy>().DecreaseHealth(damage);
			}
		}
		foreach (GameObject enemy in GameObject.FindGameObjectsWithTag("Boss"))
		{
			if (enemy.GetComponent<Enemy>().IsNextToPlayer)
			{
				damage = (float)Math.Round(new FloatRange(0, Damage).Random, 2);

				// Carry out the extra function of the item if it has one.
				if (extra != null)
				{
					extra(this.Type, enemy.GetComponent<Enemy>());
				}

				// Decrease enemy health and create damage label.
				enemy.GetComponent<Enemy>().DecreaseHealth(damage);
			}
		}
		return damage;
	}
Beispiel #2
0
	public void SetupItem()
	{
		PerformWeaponExtra = new WeaponExtras(FigureOutWeaponExtras);

		if (Type == ItemType.Apple)
		{
			Name = "Apple";
			Stackable = true;
		}
		if (Type == ItemType.Arrow)
		{
			Name = "Arrow";
			Stackable = true;
		}
		if (Type == ItemType.BowAndArrow)
		{
			Name = "Bow";
			Stackable = false;
		}
		if (Type == ItemType.Bread)
		{
			Name = "Bread";
			Stackable = true;
		}
		if (Type == ItemType.CurvedSword)
		{
			Name = "Curved Sword";
			Stackable = false;
		}
		if (Type == ItemType.ElectricSword)
		{
			Name = "Electric Sword";
			Stackable = false;
		}
		if (Type == ItemType.FlamingSword)
		{
			Name = "Flaming Sword";
			Stackable = false;
		}
		if (Type == ItemType.HealingSword)
		{
			Name = "Healing Sword";
			Stackable = false;
		}
		if (Type == ItemType.IceSword)
		{
			Name = "Ice Sword";
			Stackable = false;
		}
		if (Type == ItemType.IronSword)
		{
			Name = "Iron Sword";
			Stackable = false;
		}
		if (Type == ItemType.LongSword)
		{
			Name = "Long Sword";
			Stackable = false;
		}
		if (Type == ItemType.Mace)
		{
			Name = "Mace";
			Stackable = false;
		}
		if (Type == ItemType.MagicWand)
		{
			Name = "Magic Wand";
			Stackable = false;
		}
		if (Type == ItemType.Meat)
		{
			Name = "Meat";
			Stackable = true;
		}
		if (Type == ItemType.PoisonArrow)
		{
			Name = "Poison Arrow";
			Stackable = true;
		}
		if (Type == ItemType.Staff)
		{
			Name = "Staff";
			Stackable = false;
		}
		if (Type == ItemType.SteelSword)
		{
			Name = "Steel Sword";
			Stackable = false;
		}
		if (Type == ItemType.Water)
		{
			Name = "Water";
			Stackable = true;
		}
		if (Type == ItemType.WoodenSword)
		{
			Name = "Wooden Sword";
			Stackable = false;
		}
	}