feat: implement plasma gun and rocket swarm mechanics along with various 3D asset imports
This commit is contained in:
+12
-41
@@ -21,45 +21,16 @@ func _init() -> void:
|
||||
penetration_damage_penalty = 0.5
|
||||
|
||||
func _build_model() -> void:
|
||||
position = Vector3(0.3, -0.3, -0.8)
|
||||
|
||||
var mat_green = StandardMaterial3D.new()
|
||||
mat_green.albedo_color = Color(0.1, 0.4, 0.1)
|
||||
var mat_black = StandardMaterial3D.new()
|
||||
mat_black.albedo_color = Color(0.1, 0.1, 0.1)
|
||||
|
||||
# Body
|
||||
var body = MeshInstance3D.new()
|
||||
var b_mesh = BoxMesh.new()
|
||||
b_mesh.size = Vector3(0.06, 0.12, 0.6)
|
||||
b_mesh.material = mat_green
|
||||
body.mesh = b_mesh
|
||||
model_root.add_child(body)
|
||||
|
||||
# Scope
|
||||
var scope = MeshInstance3D.new()
|
||||
var s_mesh = CylinderMesh.new()
|
||||
s_mesh.top_radius = 0.03
|
||||
s_mesh.bottom_radius = 0.03
|
||||
s_mesh.height = 0.25
|
||||
s_mesh.material = mat_black
|
||||
scope.mesh = s_mesh
|
||||
scope.rotation.x = deg_to_rad(90)
|
||||
scope.position = Vector3(0, 0.09, -0.1)
|
||||
model_root.add_child(scope)
|
||||
|
||||
# Long Barrel
|
||||
var barrel = MeshInstance3D.new()
|
||||
var bar_mesh = CylinderMesh.new()
|
||||
bar_mesh.top_radius = 0.015
|
||||
bar_mesh.bottom_radius = 0.02
|
||||
bar_mesh.height = 0.6
|
||||
bar_mesh.material = mat_black
|
||||
barrel.mesh = bar_mesh
|
||||
barrel.rotation.x = deg_to_rad(90)
|
||||
barrel.position = Vector3(0, 0.04, -0.6)
|
||||
model_root.add_child(barrel)
|
||||
|
||||
position = Vector3(0.3, -0.3, -0.729)
|
||||
|
||||
var model_scene = load("res://assets/weapons/awp/source/L118a1.fbx")
|
||||
if model_scene:
|
||||
var model = model_scene.instantiate()
|
||||
model_root.add_child(model)
|
||||
model.scale = Vector3(0.275, 0.275, 0.275)
|
||||
model.rotation_degrees.y = 90
|
||||
for light in model.find_children("*", "Light3D", true, false):
|
||||
light.queue_free()
|
||||
# Audio
|
||||
fire_sound = AudioStreamPlayer3D.new()
|
||||
fire_sound.bus = "SFX"
|
||||
@@ -85,7 +56,7 @@ func _process(delta: float) -> void:
|
||||
rig.set_weapon_fov(ads_fov if is_ads else -1.0)
|
||||
|
||||
# Move model slightly based on ADS
|
||||
var target_pos = Vector3(0.0, -0.15, -0.6) if is_ads else Vector3(0.3, -0.3, -0.8)
|
||||
var target_pos = Vector3(0.0, -0.15, -0.608) if is_ads else Vector3(0.3, -0.3, -0.729)
|
||||
position = position.lerp(target_pos, 15.0 * delta)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
@@ -110,4 +81,4 @@ func unequip() -> void:
|
||||
if rig and rig.has_method("set_weapon_fov"):
|
||||
rig.set_weapon_fov(-1.0)
|
||||
target_fov = default_fov
|
||||
position = Vector3(0.3, -0.3, -0.8)
|
||||
position = Vector3(0.3, -0.3, -0.729)
|
||||
|
||||
Reference in New Issue
Block a user