Quantcast
Channel: Answers for "Attack selected Enemy Turn Based Combat"
Viewing all articles
Browse latest Browse all 4

Answer by Hollow Mockery

$
0
0
Set up parameters in your damage function. like this for example: public float CurrentHealth; public float DamageThreshold; public float DamageResistance; public void takeDamage(float Damage, float AP){ CurrentHealth -= (Damage - Mathf.Max(DamageThreshold - AP,0)) * (1-DamageResistance); } so when you want to apply damage you'd have script on your projectile for example that would find the takeDamage function in the Health script on the target. public float Damage; public float AP; /* With a raycast hit for example */ health = hit.transform.gameObject.GetComponent(); if(health != null){health.takeDamage(Damage, AP);} I'm using armor penetration and damage resistance, but you could take those out or add in other types of resistance, damage or effects.

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>