#pragma warning restore 0169 protected override void OnUpdate() { PlayerSystem.Sync(); ZakoSystem.Sync(); var spawner = ECSBulletManager.GetBulletSpawnDataQueue(); BulletSpawnData data; while (spawner.TryDequeue(out data)) { if (data.type_ == 0) { ECSBulletManager.spawnBullet(PostUpdateCommands, Time.GetCurrent(), ref data.position_, ref data.velocity_); } else { ECSBulletManager.spawnEnemyBullet(PostUpdateCommands, Time.GetCurrent(), ref data.position_, ref data.velocity_); } } }
public void Execute(int i) { var random = random_list_[i]; var pos = new float3(0f, 0f, 0f); var vel = random.onSphere(10f); ECSBulletManager.spawnBullet(command_buffer_, time_, ref pos, ref vel); vel = random.onSphere(10f); ECSBulletManager.spawnEnemyBullet(command_buffer_, time_, ref pos, ref vel); random_list_[i] = random; }
protected override void OnUpdate() { var time = Time.GetCurrent(); for (var i = 0; i < group_.random_list_.Length; ++i) { var random = group_.random_list_[i]; var pos = new float3(0f, 0f, 0f); var vel = random.onSphere(10f); ECSBulletManager.spawnBullet(PostUpdateCommands, time, ref pos, ref vel); vel = random.onSphere(10f); ECSBulletManager.spawnEnemyBullet(PostUpdateCommands, time, ref pos, ref vel); group_.random_list_[i] = random; } }
protected override JobHandle OnUpdate(JobHandle inputDeps) { CursorSystem.Sync(); game_camera_update_system_.Sync(); handle_ = inputDeps; if (lockon_limit_.IsCreated) { lockon_limit_.Dispose(); } // for (var i = 0; i < player_group_.Length; ++i) { int i = 0; // only one player now. { var entity = player_group_.entity_list_[i]; var player = player_group_.player_list_[i]; var player_position = player_group_.position_list_[i]; var player_rotation = player_group_.rotation_list_[i]; // Debug.Log(player.life_.get()); var pc = player_controller_list_from_entity_[entity]; if (pc.lockon_ != 0) { lockon_limit_ = new NativeLimitedCounter(Allocator.TempJob); var sumup_job = new SumupJob { time_ = Time.GetCurrent(), locktarget_list_ = lockon_group_.locktarget_list_, lockon_limit_ = lockon_limit_, }; handle_ = sumup_job.Schedule(lockon_group_.Length, 8, handle_); var lockon_job = new LockonJob { time_ = Time.GetCurrent(), locktarget_entity_list_ = lockon_group_.entity_list_, locktarget_list_ = lockon_group_.locktarget_list_, locktarget_local_to_world_list_ = lockon_group_.local_to_world_list_, player_position_ = player_position, player_normal_ = math.mul(player_rotation.Value, new float3(0f, 0f, 1f)), lockon_limit_ = lockon_limit_, sight_spawner_ = ECSSightManager.GetSightSpawnDataQueue(), }; handle_ = lockon_job.Schedule(lockon_group_.Length, 8, handle_); } if (pc.fire_laser_ != 0) { var fire_laser_job = new FireLaserJob { time_ = Time.GetCurrent(), command_buffer_ = barrier_.CreateCommandBuffer(), entity_list_ = lockon_group_.entity_list_, player_position_ = player_position, player_rotation_ = player_rotation, player_ = player, locktarget_list_ = lockon_group_.locktarget_list_, random_list_ = lockon_group_.random_list_, }; handle_ = fire_laser_job.Schedule(lockon_group_.Length, 8, handle_); } if (pc.fire_bullet_ != 0) { player.fire_bullet_time_ = Time.GetCurrent(); player.fire_bullet_count_ = 0; } const int RENSYA_NUM = 16; if (Time.GetCurrent() - player.fire_bullet_time_ >= 0f && player.fire_bullet_count_ < RENSYA_NUM) { var vel = math.mul(player_rotation.Value, new float3(0f, 0f, 48f)); var pos0 = math.mul(player_rotation.Value, new float3(0.3f, 0.1f, 0.8f)) + player_position.Value; ECSBulletManager.spawnBullet(barrier_.CreateCommandBuffer(), Time.GetCurrent(), ref pos0, ref vel); var pos1 = math.mul(player_rotation.Value, new float3(-0.3f, 0.1f, 0.8f)) + player_position.Value; ECSBulletManager.spawnBullet(barrier_.CreateCommandBuffer(), Time.GetCurrent(), ref pos1, ref vel); const float INTERVAL = 0.05f; player.fire_bullet_time_ = Time.GetCurrent() + INTERVAL; ++player.fire_bullet_count_; } player_group_.player_list_[i] = player; } var job = new PlayerJob { dt_ = Time.GetDT(), position_list_ = player_group_.position_list_, rotation_list_ = player_group_.rotation_list_, rb_position_list_ = player_group_.rb_position_list_, player_list_ = player_group_.player_list_, player_controller_list_ = player_group_.player_controller_list_, position_list_from_entity_ = position_list_from_entity_, }; handle_ = job.Schedule(player_group_.Length, 8, handle_); return(handle_); }