Commit 09d8045c authored by Gavin An's avatar Gavin An

Mage 추가

parent 097a6fe6
......@@ -4,12 +4,12 @@ importer="scene"
importer_version=1
type="PackedScene"
uid="uid://uyra5vsbtakn"
path="res://.godot/imported/arrow.glb-1021954cfc8244ae2ad40b00b87d5323.scn"
path="res://.godot/imported/arrow.glb-4c220a10dcd473aa8631f3c94e6eae1a.scn"
[deps]
source_file="res://assets/models/items/weapons/azure_bow/arrow.glb"
dest_files=["res://.godot/imported/arrow.glb-1021954cfc8244ae2ad40b00b87d5323.scn"]
source_file="res://assets/models/projectiles/arrow/arrow.glb"
dest_files=["res://.godot/imported/arrow.glb-4c220a10dcd473aa8631f3c94e6eae1a.scn"]
[params]
......
......@@ -3,7 +3,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://ich0m8enn06g"
path.s3tc="res://.godot/imported/arrow_0.jpg-64c6e32502091e099449bd2e131b1bb8.s3tc.ctex"
path.s3tc="res://.godot/imported/arrow_0.jpg-27d49620f1882ace82ae8857b860a0f4.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
......@@ -14,8 +14,8 @@ generator_parameters={
[deps]
source_file="res://assets/models/items/weapons/azure_bow/arrow_0.jpg"
dest_files=["res://.godot/imported/arrow_0.jpg-64c6e32502091e099449bd2e131b1bb8.s3tc.ctex"]
source_file="res://assets/models/projectiles/arrow/arrow_0.jpg"
dest_files=["res://.godot/imported/arrow_0.jpg-27d49620f1882ace82ae8857b860a0f4.s3tc.ctex"]
[params]
......
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://blm604moyxwsh"
path="res://.godot/imported/fire_ball.glb-2ebd501a8b685d93a15bb416cd7befb0.scn"
[deps]
source_file="res://assets/models/projectiles/fireball/fire_ball.glb"
dest_files=["res://.godot/imported/fire_ball.glb-2ebd501a8b685d93a15bb416cd7befb0.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
gltf/naming_version=2
gltf/embedded_image_handling=1
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://br8rlbdv6ssla"
path.s3tc="res://.godot/imported/fire_ball_Baked_BaseColor.png-d9411044648a84b90a6ddfdf65be247a.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "8312a3abf9f8b098cd9a932ec5f20ef3"
}
[deps]
source_file="res://assets/models/projectiles/fireball/fire_ball_Baked_BaseColor.png"
dest_files=["res://.godot/imported/fire_ball_Baked_BaseColor.png-d9411044648a84b90a6ddfdf65be247a.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://qi6jn6gpq7mk"
path="res://.godot/imported/mage.fbx-f169e626f0c2f415babcc12bfa6ee8a8.scn"
[deps]
source_file="res://assets/models/units/mage/mage.fbx"
dest_files=["res://.godot/imported/mage.fbx-f169e626f0c2f415babcc12bfa6ee8a8.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=true
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
fbx/importer=0
fbx/allow_geometry_helper_nodes=false
fbx/embedded_image_handling=1
fbx/naming_version=2
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bcsoptqukaa5o"
path.s3tc="res://.godot/imported/mage_0.png-ac4174dd7ab2e29fd2b5516f2dcff0e6.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
generator_parameters={
"md5": "620679973958a4eceea895a03ddb332c"
}
[deps]
source_file="res://assets/models/units/mage/mage_0.png"
dest_files=["res://.godot/imported/mage_0.png-ac4174dd7ab2e29fd2b5516f2dcff0e6.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,7 +21,6 @@ GameManager="*res://src/autoload/game_manager.gd"
DataManager="*res://src/autoload/data_manager.gd"
SceneChanger="*res://src/autoload/scene_changer.tscn"
[display]
window/size/viewport_width=1280
......
......@@ -48,6 +48,19 @@ func _initialize_unit_templates() -> void:
ranger.is_ranged = true
ranger.unit_color = Color(0.12, 0.75, 0.25, 1.0) # 녹색
unit_templates.append(ranger)
# 4. Mage (마법사 유닛)
var mage: UnitData = UnitData.new()
mage.unit_id = "Unit_Mage"
mage.unit_name = "Mage"
mage.damage = 35.0
mage.cooldown = 1.6
mage.move_speed = 3.5
mage.attack_range = 8.0
mage.is_ranged = true
mage.unit_color = Color(0.9, 0.25, 0.15, 1.0)
unit_templates.append(mage)
## 몬스터 능력치 데이터 초기 셋업
func _initialize_monster_templates() -> void:
......
[gd_scene format=3]
[ext_resource type="PackedScene" path="res://assets/models/units/mage/mage.fbx" id="1_mage_fbx"]
[ext_resource type="AnimationLibrary" path="res://assets/models/units/mage/mage_animations.tres" id="2_mage_anims"]
[node name="mage" instance=ExtResource("1_mage_fbx")]
transform = Transform3D(-1, 0, -8.742278e-08, 0, 1, 0, 8.742278e-08, 0, -1, 0, 0, 0)
[node name="AnimationPlayer" parent="." index="1"]
libraries/ = ExtResource("2_mage_anims")
class_name MageUnit
extends BaseUnit
## Mage 유닛 고유 동작 및 비주얼 제어 클래스
func _setup_unit_visuals() -> void:
# 자식 노드 중 메이지 모델 노드 명시적 확보
var m_name: String = "mage"
var node: Node3D = get_node_or_null(m_name) as Node3D
if not node:
push_error("MageUnit: Model node '" + m_name + "' not found under children.")
return
_model_instance = node
# 메이지 스킨 및 무기 결합
UnitHelper.apply_skin(_model_instance, "res://assets/models/units/mage/mage_0.png")
UnitHelper.attach_weapon(_model_instance, unit_data)
# 애니메이션 플레이어 및 라이브러리 연동
_model_anim_player = UnitHelper.find_animation_player(_model_instance)
if _model_anim_player:
print("MageUnit: Linked pre-configured model & AnimationPlayer: ", m_name)
var anim_lib_path: String = "res://assets/models/units/" + m_name + "/" + m_name + "_animations.tres"
if ResourceLoader.exists(anim_lib_path):
var lib: AnimationLibrary = load(anim_lib_path) as AnimationLibrary
if lib:
if _model_anim_player.has_animation_library(""):
_model_anim_player.remove_animation_library("")
if not _model_anim_player.has_animation_library(m_name):
_model_anim_player.add_animation_library(m_name, lib)
print("MageUnit: Loaded and registered ", m_name, " animations library successfully.")
UnitHelper.clean_root_animation_tracks(_model_anim_player)
## 메이지 애니메이션 갱신 제어
func _update_animations() -> void:
if not _model_anim_player:
return
var m_name: String = "mage"
var library_prefix: String = m_name + "/"
var has_custom_anims: bool = _model_anim_player.has_animation(library_prefix + "Idle")
var target_anim: String = ""
var play_speed: float = 1.0
var blend_time: float = 0.2
if has_custom_anims:
# Mage용 애니메이션 매핑 (Attack, Running, Idle)
var attack_anim: String = library_prefix + "Attack"
var run_anim: String = library_prefix + "Running"
var idle_anim: String = library_prefix + "Idle"
if _attack_lock_timer > 0.0:
var base_speed: float = 1.2
if unit_data.cooldown < 0.6:
base_speed = 0.6 / unit_data.cooldown
play_speed = clampf(base_speed, 1.0, 3.0)
target_anim = attack_anim
elif velocity.length() > 0.1:
target_anim = run_anim
play_speed = 1.1
else:
target_anim = idle_anim
play_speed = 1.0
if target_anim != "" and _model_anim_player.current_animation != target_anim:
_last_anim_state = target_anim.replace(library_prefix, "")
_model_anim_player.play(target_anim, blend_time, play_speed)
else:
# Fallback 처리
var fallback_anim: String = "Armature|Armature|Basic_Jump|baselayer"
if not _model_anim_player.has_animation(fallback_anim):
return
if _attack_lock_timer > 0.0:
target_anim = fallback_anim
play_speed = 2.5
elif velocity.length() > 0.1:
target_anim = fallback_anim
play_speed = 1.5
else:
target_anim = ""
_model_anim_player.stop()
if target_anim != "" and _model_anim_player.current_animation != target_anim:
_model_anim_player.play(target_anim, blend_time, play_speed)
## 메이지 전용 발사체 생성 및 스폰
func _spawn_projectile(fire_position: Vector3) -> void:
var projectile_script = preload("res://src/entities/units/projectile.gd")
var proj: Node3D = projectile_script.new() as Node3D
proj.set("damage", unit_data.damage)
proj.set("target", _target_monster)
# 불덩이(적황색) 발사체 색상 지정
proj.set("color", Color(1.0, 0.35, 0.1, 1.0))
proj.set("use_arrow_model", false)
get_tree().current_scene.add_child(proj)
proj.global_position = fire_position
[gd_scene format=3 uid="uid://br3p733g43o5f"]
[ext_resource type="Script" uid="uid://bbduakccdnoye" path="res://src/entities/units/mage/mage_unit.gd" id="1_mage_script"]
[ext_resource type="PackedScene" path="res://src/entities/units/mage/mage.tscn" id="2_mage_scene"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_body"]
radius = 0.4
height = 1.2
[sub_resource type="CapsuleMesh" id="CapsuleMesh_unit"]
radius = 0.4
height = 1.2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ring"]
albedo_color = Color(0.9, 0.25, 0.15, 1)
emission_enabled = true
emission = Color(0.9, 0.25, 0.15, 1)
emission_energy_multiplier = 2.0
[sub_resource type="TorusMesh" id="TorusMesh_selection"]
material = SubResource("StandardMaterial3D_ring")
inner_radius = 0.65
outer_radius = 0.7
[node name="MageUnit" type="CharacterBody3D" unique_id=978794555]
script = ExtResource("1_mage_script")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1853260703]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6, 0)
shape = SubResource("CapsuleShape3D_body")
[node name="VisualMesh" type="MeshInstance3D" parent="." unique_id=1705288133]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6, 0)
visible = false
mesh = SubResource("CapsuleMesh_unit")
[node name="SelectionRing" type="MeshInstance3D" parent="." unique_id=182360238]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.02, 0)
mesh = SubResource("TorusMesh_selection")
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="." unique_id=220791161]
[node name="mage" parent="." unique_id=656974931 instance=ExtResource("2_mage_scene")]
[editable path="mage"]
......@@ -14,8 +14,8 @@ var color: Color = Color(1.0, 0.9, 0.2, 1.0) # 기본 노란색 발사체
var use_arrow_model: bool = false
# 화살 모델 경로
const ARROW_MODEL_PATH: String = "res://assets/models/items/weapons/azure_bow/arrow.glb"
const ARROW_TEXTURE_PATH: String = "res://assets/models/items/weapons/azure_bow/arrow_0.jpg"
const ARROW_MODEL_PATH: String = "res://assets/models/projectiles/arrow/arrow.glb"
const ARROW_TEXTURE_PATH: String = "res://assets/models/projectiles/arrow/arrow_0.jpg"
func _ready() -> void:
if use_arrow_model and ResourceLoader.exists(ARROW_MODEL_PATH):
......
......@@ -5,5 +5,5 @@
[node name="Stage2Map" type="GridMap" unique_id=1363623219]
mesh_library = ExtResource("1_mesh_lib")
data = {
"cells": PackedInt32Array(65531, 65531, 3, 65531, 65532, 3, 65531, 65533, 3, 65531, 65534, 3, 65531, 65535, 3, 65531, 0, 3, 65531, 1, 3, 65531, 2, 3, 65531, 3, 3, 65531, 4, 3, 65532, 65531, 3, 65532, 65532, 2, 65532, 65533, 2, 65532, 65534, 2, 65532, 65535, 2, 65532, 0, 2, 65532, 1, 2, 65532, 2, 2, 65532, 3, 2, 65532, 4, 3, 65533, 65531, 3, 65533, 65532, 2, 65533, 65533, 2, 65533, 65534, 2, 65533, 65535, 2, 65533, 0, 2, 65533, 1, 2, 65533, 2, 2, 65533, 3, 2, 65533, 4, 3, 65534, 65531, 3, 65534, 65532, 2, 65534, 65533, 2, 65534, 65534, 2, 65534, 65535, 2, 65534, 0, 2, 65534, 1, 2, 65534, 2, 2, 65534, 3, 2, 65534, 4, 3, 65535, 65531, 3, 65535, 65532, 2, 65535, 65533, 2, 65535, 65534, 2, 65535, 65535, 2, 65535, 0, 2, 65535, 1, 2, 65535, 2, 2, 65535, 3, 2, 65535, 4, 3, 0, 65531, 3, 0, 65532, 2, 0, 65533, 2, 0, 65534, 2, 0, 65535, 2, 0, 0, 2, 0, 1, 2, 0, 2, 2, 0, 3, 2, 0, 4, 3, 1, 65531, 3, 1, 65532, 2, 1, 65533, 2, 1, 65534, 2, 1, 65535, 2, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1, 3, 2, 1, 4, 3, 2, 65531, 3, 2, 65532, 2, 2, 65533, 2, 2, 65534, 2, 2, 65535, 2, 2, 0, 2, 2, 1, 2, 2, 2, 2, 2, 3, 2, 2, 4, 3, 3, 65531, 3, 3, 65532, 2, 3, 65533, 2, 3, 65534, 2, 3, 65535, 2, 3, 0, 2, 3, 1, 2, 3, 2, 2, 3, 3, 2, 3, 4, 3, 4, 65531, 3, 4, 65532, 3, 4, 65533, 3, 4, 65534, 3, 4, 65535, 3, 4, 0, 3, 4, 1, 3, 4, 2, 3, 4, 3, 3, 4, 4, 3)
"cells": PackedInt32Array(65531, 65531, 3, 65531, 65532, 3, 65531, 65533, 3, 65531, 65534, 3, 65531, 65535, 3, 65531, 0, 3, 65531, 1, 3, 65531, 2, 3, 65531, 3, 3, 65531, 4, 3, 65532, 65531, 3, 65532, 65532, 2, 65532, 65533, 2, 65532, 65534, 2, 65532, 65535, 2, 65532, 0, 2, 65532, 1, 2, 65532, 2, 2, 65532, 3, 2, 65532, 4, 3, 65533, 65531, 3, 65533, 65532, 2, 65533, 65533, 2, 65533, 65534, 2, 65533, 65535, 2, 65533, 0, 2, 65533, 1, 2, 65533, 2, 2, 65533, 3, 2, 65533, 4, 3, 65534, 65531, 3, 65534, 65532, 2, 65534, 65533, 2, 65534, 65534, 2, 65534, 65535, 2, 65534, 0, 2, 65534, 1, 2, 65534, 2, 2, 65534, 3, 2, 65534, 4, 3, 65535, 65531, 3, 65535, 65532, 2, 65535, 65533, 2, 65535, 65534, 2, 65535, 65535, 2, 65535, 0, 2, 65535, 1, 2, 65535, 2, 2, 65535, 3, 2, 65535, 4, 3, 0, 65531, 3, 0, 65532, 2, 0, 65533, 2, 0, 65534, 2, 0, 65535, 2, 0, 0, 2, 0, 1, 2, 0, 2, 2, 0, 3, 2, 0, 4, 3, 1, 65531, 3, 1, 65532, 2, 1, 65533, 2, 1, 65534, 2, 1, 65535, 2, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1, 3, 2, 1, 4, 3, 2, 65531, 3, 2, 65532, 2, 2, 65533, 2, 2, 65534, 2, 2, 65535, 2, 2, 0, 2, 2, 1, 2, 2, 2, 2, 2, 3, 2, 2, 4, 3, 3, 65531, 3, 3, 65532, 2, 3, 65533, 2, 3, 65534, 2, 3, 65535, 2, 3, 0, 2, 3, 1, 2, 3, 2, 2, 3, 3, 2, 3, 4, 3, 4, 65532, 3, 4, 65533, 3, 4, 65534, 3, 4, 65535, 3, 4, 0, 3, 4, 1, 3, 4, 2, 3, 4, 3, 3, 4, 4, 3, 4, 65531, 3)
}
......@@ -124,6 +124,10 @@ func _on_spawn_pressed() -> void:
var ranger_scene: PackedScene = load("res://src/entities/units/ranger/ranger_unit.tscn") as PackedScene
if ranger_scene:
target_scene = ranger_scene
elif chosen_template.unit_id == "Unit_Mage":
var mage_scene: PackedScene = load("res://src/entities/units/mage/mage_unit.tscn") as PackedScene
if mage_scene:
target_scene = mage_scene
var new_unit: Node = target_scene.instantiate()
var parent_scene: Node = get_tree().current_scene
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment