private void OnCollisionEnter(Collision collision) { if (!meleeWeapon.IsMeleeAttackEnabled) { return; } damagable = collision.gameObject.GetComponentInParent <IDamagableData>(); if (damagable != null) { damagable.Character.TakeDamage(meleeWeapon.WeaponInfo.MeleeProperties.CurrentSlash.Damage); } }
public Vector3 Shoot(Transform transform) { if (currentAmmoInMagazine > 0) { currentAmmoInMagazine--; RaycastHit hit; // TODO: distance, bullet prefab enable if (Physics.Raycast(transform.position, transform.forward, out hit, 100, damagableLayer)) { IDamagableData info = hit.transform.GetComponentInParent <IDamagableData>(); if (info != null) { info.Character.TakeDamage(ShellDamage); //TODO damage value for weapon } return(hit.point); } } return(Vector3.zero); }