BulletData InitBullet(InputData input) { BulletData ret = new BulletData(); GunnerData gunner = Gunners.Find(_ => _.id == input.gunnerId); if (gunner == null) { Debug.LogError("存在しないプレイヤーID"); return(ret); } ret.knockback = 3; ret.sFrame = input.inFrame; ret.eFrame = -1; ret.bulletId = input.bulletId; ret.gunnerId = input.gunnerId; ret.sPos = new Vector2(gunner.cPos.x, gunner.cPos.y); ret.cPos = new Vector2(gunner.cPos.x, gunner.cPos.y); ret.ePos = new Vector2(0, 0); ret.strength = input.strength; ret.angle = (float)input.angle / 10; ret.cRad = 0; ret.number = input.number; ret.hitGunnerIdsAndDamage = new Dictionary <int, int>(); return(ret); }
void KnockBack(int id, BulletData bullet) { GunnerData gunner = Gunners.Find(_ => _.id == id); if (gunner != null) { gunner.cKnockback += CalcKnockBackDirection(bullet.angle) * bullet.knockback; } }