public static int calculateDamage(ShotsFired myHits) { int hits = 0; for (int i = 0; i < myHits.power; i++) { if (Random.value <= myHits.hitChance) { hits++; } } CombatIndicationSpawner.spawnHits(myHits.source, hits); int damage = 0; for (int i = 0; i < hits; i++) { //higher dodge chance means less bullets go through if (Random.value >= myHits.dodgeChance) { damage++; } } CombatIndicationSpawner.spawnMisses(myHits.destination, hits - damage); return(damage); }
static TutorialCombat() { marker = GameObject.Find("Marker").GetComponent <Marker>(); CombatIndicationSpawner.instantiate(); }