fix: removing placing the 2d graphic on entities and changing it to a swipe for the knife
This commit is contained in:
@@ -4,6 +4,7 @@ class_name ImpactSpawner
|
||||
static var bullet_hole_mat: StandardMaterial3D = null
|
||||
static var crater_mat: StandardMaterial3D = null
|
||||
static var plasma_mat: StandardMaterial3D = null
|
||||
static var slash_mat: StandardMaterial3D = null
|
||||
|
||||
static func _ensure_mats():
|
||||
if bullet_hole_mat != null:
|
||||
@@ -51,13 +52,24 @@ static func _ensure_mats():
|
||||
plasma_mat.emission_enabled = true
|
||||
plasma_mat.emission_texture = tex_p
|
||||
plasma_mat.emission_energy_multiplier = 2.0
|
||||
|
||||
var tex_s = make_tex.call(
|
||||
[Color(0.9, 0.9, 0.9, 1.0), Color(0.8, 0.8, 0.8, 0.8), Color(0.8, 0.8, 0.8, 0.0)],
|
||||
[0.0, 0.5, 1.0], 64)
|
||||
slash_mat = StandardMaterial3D.new()
|
||||
slash_mat.albedo_texture = tex_s
|
||||
slash_mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
|
||||
|
||||
static func spawn(scene_tree: SceneTree, type: String, pos: Vector3, normal: Vector3, size: float = 0.2):
|
||||
_ensure_mats()
|
||||
|
||||
var mi = MeshInstance3D.new()
|
||||
var qm = QuadMesh.new()
|
||||
qm.size = Vector2(size, size)
|
||||
|
||||
if type == "slash":
|
||||
qm.size = Vector2(size * 4.0, size * 0.4)
|
||||
else:
|
||||
qm.size = Vector2(size, size)
|
||||
|
||||
var mat: StandardMaterial3D
|
||||
if type == "bullet":
|
||||
@@ -66,6 +78,8 @@ static func spawn(scene_tree: SceneTree, type: String, pos: Vector3, normal: Vec
|
||||
mat = crater_mat.duplicate()
|
||||
elif type == "plasma":
|
||||
mat = plasma_mat.duplicate()
|
||||
elif type == "slash":
|
||||
mat = slash_mat.duplicate()
|
||||
|
||||
qm.material = mat
|
||||
mi.mesh = qm
|
||||
|
||||
Reference in New Issue
Block a user