public void SpawnImpact(WeaponData.WeaponType weaponType, Vector3 position) { PooledObject pooledObject = ObjectPoolManager.Instance.GetPooledObject(WeaponData.GetImpactPool(weaponType), AmmoContainer.transform); Impact impact = pooledObject?.GetComponent <Impact>(); if (null == impact) { return; } impact.transform.position = position; StartCoroutine(ImpactCoroutine(pooledObject)); }
public virtual void Initialize(Fighter fighter, int slotId, WeaponData.WeaponType weaponType, int damage) { Fighter = fighter; gameObject.layer = fighter.gameObject.layer; WeaponType = weaponType; Damage = damage; Transform spawn = fighter.GetWeaponAmmoSpawnTransform(slotId); transform.position = spawn.position; transform.rotation = spawn.rotation; }
public void Damage(int amount, WeaponData.WeaponType type) { if (!GameStageManager.Instance.IsGameStarted) { return; } float reducedAmount = amount - (amount * _armor.GetDamageReduction(type)); if (reducedAmount < MinimumDamage) { reducedAmount = MinimumDamage; } CurrentHealth -= reducedAmount; }
public void IncreaseStrength(WeaponData.WeaponType type, int strength, int damageReductionPercent, int maxReductionPercent) { if (!_damageReductionPercents.ContainsKey(type)) { return; } // TODO: can this be done with math rather than a for-loop? int reduction = _damageReductionPercents[type]; for (int i = 0; i < strength; ++i) { reduction = (int)Mathf.Clamp(reduction + (100 - reduction) * (damageReductionPercent / 100.0f), 0, maxReductionPercent); } _damageReductionPercents[type] = reduction; }
public float GetDamageReduction(WeaponData.WeaponType type) { return(_damageReductionPercents.GetOrDefault(type) / 100.0f); }
public override void Initialize(Fighter fighter, int slotId, WeaponData.WeaponType weaponType, int damage) { base.Initialize(fighter, slotId, weaponType, damage); _rigidBody.velocity = Fighter.Forward * _velocity; }