// ---------------------------------------------------- #region // Barrage Methods // 自機に狙い撃ち void Aiming(ref int jobIndex, ref Position2D enemyPosition, ref EnemyParam param, ref EnemyData data) { CommandBuffer.Instantiate(jobIndex, this.EnemyBulletPrefab); CommandBuffer.SetComponent(jobIndex, enemyPosition); CommandBuffer.SetComponent(jobIndex, new BulletData { Speed = param.BulletParam.Speed, Angle = MathHelper.Aiming(enemyPosition.Value, this.PlayerPosition), Lifespan = param.BulletParam.Lifespan, }); }
// 前方に分岐撃ち void NWay(ref int jobIndex, ref Position2D enemyPosition, ref EnemyParam param, ref EnemyData data, int bulletCount) { float range = math.radians(this.BarrageParamPtr->CommonWay.Range); var angle = MathHelper.Aiming(enemyPosition.Value, this.PlayerPosition); int halfBulletCount = (int)(bulletCount / 2); for (int i = 0; i < bulletCount; ++i) { CommandBuffer.Instantiate(jobIndex, this.EnemyBulletPrefab); CommandBuffer.SetComponent(jobIndex, enemyPosition); CommandBuffer.SetComponent(jobIndex, new BulletData { Speed = param.BulletParam.Speed, Angle = angle + ((i - halfBulletCount) * range), Lifespan = param.BulletParam.Lifespan, }); } }
// 前方にランダムに分岐撃ち void RandomWay(ref int jobIndex, ref Position2D enemyPosition, ref EnemyParam param, ref EnemyData data) { float range = this.BarrageParamPtr->RandomWay.Range; this.RandomPtr->state += 1; range = this.RandomPtr->NextFloat(-range, range); range = math.radians(range); var angle = MathHelper.Aiming(enemyPosition.Value, this.PlayerPosition); CommandBuffer.Instantiate(jobIndex, this.EnemyBulletPrefab); CommandBuffer.SetComponent(jobIndex, enemyPosition); CommandBuffer.SetComponent(jobIndex, new BulletData { Speed = param.BulletParam.Speed, Angle = angle + range, Lifespan = param.BulletParam.Lifespan, }); }