public void Execute(int i) { LockTarget lt = locktarget_list_[i]; if (!lt.isLocked(time_)) { bool can_lock = false; var locktarget_local_to_world = locktarget_local_to_world_list_[i].Value; var diff = locktarget_local_to_world.c3.xyz - player_position_.Value; float inner_product = math.dot(diff, player_normal_); if (inner_product > 0f) { float diffsqr = Vector3.Dot(diff, diff); if (inner_product * inner_product >= diffsqr * cone_cos_sqr_) { if (lt.has_direction_ != 0) { var fwd = new float4(0f, 0f, 1f, 0f); var vec = math.mul(locktarget_local_to_world, fwd).xyz; if (math.dot(diff, vec) < 0f) { can_lock = true; } } else { can_lock = true; } } } if (can_lock) { if (lockon_limit_.TryIncrement(LASER_MAX /* inclusive_limit */)) { lt.setLocked(time_); locktarget_list_[i] = lt; sight_spawner_.Enqueue(new SightSpawnData { target_entity_ = locktarget_entity_list_[i], }); } } } }