private void OnAttack(GameObject target) { GameObject snowball = Instantiate(snowballPrefab); snowball.transform.position = this.transform.position; SnowBallMovement script = snowball.GetComponent <SnowBallMovement>(); script.Target = target; script.Damage = baseScript.stats.attackDamage; }
void Attack() { GameObject target = targeting.findClosestUnit(this.transform.position); if (target == null) { return; } GameObject projectile = Instantiate(projectilePrefab); projectile.transform.position = this.transform.position; SnowBallMovement projScript = projectile.GetComponent <SnowBallMovement>(); projScript.Target = target; projScript.Damage = this.damage; }