private bool TryDamage(MatrixManager.CustomPhysicsHit hit) { var coll = hit.CollisionHit.GameObject; if (coll == null) { return(true); } var livingHealth = coll.GetComponent <LivingHealthBehaviour>(); if (livingHealth == null) { return(false); } var newDamage = projectileKineticDamage.DamageByPressureModifier(damageData.Damage); livingHealth.ApplyDamageToBodypart(shooter, newDamage, damageData.AttackType, damageData.DamageType, targetZone); Chat.AddThrowHitMsgToChat(gameObject, coll.gameObject, targetZone); Logger.LogTraceFormat( "Hit {0} for {1} with HealthBehaviour! bullet absorbed", Category.Firearms, livingHealth.gameObject.name, newDamage); return(true); }
private bool TryDamage(MatrixManager.CustomPhysicsHit hit) { var coll = hit.CollisionHit.GameObject; if (coll == null) { return(false); } var integrity = coll.GetComponent <Integrity>(); if (integrity == null) { return(false); } float newDamage = projectileKineticDamage.DamageByPressureModifier(damageData.Damage); integrity.ApplyDamage(newDamage, damageData.AttackType, damageData.DamageType); Chat.AddThrowHitMsgToChat(gameObject, coll.gameObject, targetZone); Logger.LogTraceFormat( "Hit {0} for {1} with Integrity! bullet absorbed", Category.Firearms, integrity.gameObject.name, newDamage); return(true); }
private bool TryDamage(RaycastHit2D hit) { var coll = hit.collider; var integrity = coll.GetComponent <Integrity>(); if (integrity == null) { return(false); } float newDamage = projectileKineticDamage.DamageByPressureModifier(damageData.Damage); integrity.ApplyDamage(newDamage, damageData.AttackType, damageData.DamageType); Chat.AddAttackMsgToChat( shooter, coll.gameObject, BodyPartType.None, weapon.gameObject); Logger.LogTraceFormat( "Hit {0} for {1} with Integrity! bullet absorbed", Category.Firearms, integrity.gameObject.name, newDamage); return(true); }
public bool Interact(RaycastHit2D hit, InteractableTiles interactableTiles, Vector3 worldPosition) { var layerToHit = GetLayerToHitOrGetNull(interactableTiles.MetaTileMap.DamageableLayers); if (layerToHit == null) { return(false); } float newDamage = projectileKineticDamage.DamageByPressureModifier(damageData.Damage); layerToHit.TilemapDamage.ApplyDamage(damageData.Damage, damageData.AttackType, worldPosition); return(true); }
private bool TryDamage(RaycastHit2D hit) { var coll = hit.collider; var livingHealth = coll.GetComponent <LivingHealthBehaviour>(); if (livingHealth == null) { return(false); } var newDamage = projectileKineticDamage.DamageByPressureModifier(damageData.Damage); livingHealth.ApplyDamageToBodypart(shooter, newDamage, damageData.AttackType, damageData.DamageType, targetZone); Chat.AddAttackMsgToChat(shooter, coll.gameObject, targetZone, weapon.gameObject); Logger.LogTraceFormat( "Hit {0} for {1} with HealthBehaviour! bullet absorbed", Category.Firearms, livingHealth.gameObject.name, newDamage); return(true); }