public void shootProjectile(IntVec2 this_pos, Projectile.ProjectileType pt, IntVec2 targetTile, float velocity, float range, float accmod, bool allied) { Gun.FiredProjectile fp; fp.accuracy_modifier_degree = 0; fp.is_crit = false; fp.projectile = pt; fp.range = range; fp.speed = velocity; gr.AddBullet(fp, accmod + (Mathf.Rad2Deg * Mathf.Atan2(targetTile.y - this_pos.y, targetTile.x - this_pos.x)), new Vector2(this_pos.x, this_pos.y), allied); }
//renderer has to handle bullets. public void shootGun(GameRenderer gr, Gun g) { if (g.bulletsLeft > 0) { var v = g.fireGun(); foreach (var b in v) { if (g.bulletsLeft == 0) { return; } if (g.consumeMultipleAmmoPerFire()) { g.bulletsLeft--; } gun1_did_fire_last_frame = true; gr.AddBullet(b, getMouseAngle(), this.transform.localPosition, true); } if (!g.consumeMultipleAmmoPerFire()) { g.bulletsLeft--; } } }