public HitInfo(DamageConfig damage, Vector3 point, bool isShowEffect, HitSources source) { this.damage = damage; this.point = point; this.isShowEffect = isShowEffect; this.source = source; }
public ItemWeaponMelee() : base() { itemType = ItemTypes.WeaponMelee; weaponMeleeType = WeaponMeleeTypes.Sword; damage = new DamageConfig(); }
protected BaseCharacterAction(string iconPath, float baseActionTime, DamageConfig damageConfig, bool targetsEnemies, bool targetsAllies) { this.icon = SingletonProvider.MainGameobjectLoader.GetPrefab <Sprite>(iconPath); this.iconPath = iconPath; this.baseActionTime = baseActionTime; this.damageConfig = damageConfig; this.targetsEnemies = targetsEnemies; this.targetsAllies = targetsAllies; }
public int CalculateFinalDamage(DamageConfig damage, bool fromPlayer = false) { int final = 0; final = (int)(Random.Range(damage.minPhysical, damage.maxPhysical) * (1f - Mathf.Clamp(physical, 0f, 1f))); final += (int)(damage.fire * (1f - Mathf.Clamp(fire, 0f, 1f))); final += (int)(damage.ice * (1f - Mathf.Clamp(ice, 0f, 1f))); final += (int)(damage.electro * (1f - Mathf.Clamp(electro, 0f, 1f))); return(final); }
public DamageConfig Copy() { DamageConfig newConfig = new DamageConfig(); newConfig.minPhysical = this.minPhysical; newConfig.maxPhysical = this.maxPhysical; newConfig.fire = this.fire; newConfig.ice = this.ice; newConfig.electro = this.electro; return(newConfig); }
// by the animation event public void OnAttack() { if (weapon == null) { return; } PlayerController player = PlayerController.Instance; if (weapon.itemType == Item.ItemTypes.Staff) { ItemWeaponStaff staff = (ItemWeaponStaff)weapon; if (player.Mana >= staff.mana) { Instantiate(staff.bullet, player.mainCamera.transform.position, player.mainCamera.transform.rotation); player.Mana -= staff.mana; } else { UIController.Instance.ShowError("Not enought mana"); } } else { RaycastHit hit; if (Physics.Raycast(player.mainCamera.transform.position, player.mainCamera.transform.TransformDirection(Vector3.forward), out hit, 4)) { IHitable hitable = hit.collider.gameObject.GetComponent(typeof(IHitable)) as IHitable; if (hitable != null) { DamageConfig damageWithStreanght = ((ItemWeaponMelee)weapon).damage.Copy(); damageWithStreanght.minPhysical += (int)(damageWithStreanght.minPhysical * 0.05f * PlayerController.Instance.experience.ActualStrenght); damageWithStreanght.maxPhysical += (int)(damageWithStreanght.maxPhysical * 0.05f * PlayerController.Instance.experience.ActualStrenght); hitable.Hit(new HitInfo(damageWithStreanght, hit.point, true, HitInfo.HitSources.Player)); } } } }
public AttackSpecificAction(string iconPath, float baseActionTime, DamageConfig damageConfig) : base(iconPath, baseActionTime, damageConfig, true, false) { }
public AttackRandomAction(string iconPath, float baseActionTime, DamageConfig damage) : base(iconPath, baseActionTime, damage, true, false) { }