锁定 headbar调整

master
chendian 2 years ago
parent 2ac3292e49
commit eaf281600d

@ -4,7 +4,7 @@
[ext_resource type="Script" path="res://script/config/character_cfg.gd" id="1_wkjce"]
[ext_resource type="Resource" uid="uid://dpajmgrlaytah" path="res://config/character_mp/normal.tres" id="2_gly3h"]
[ext_resource type="SpriteFrames" uid="uid://crdd52skym3ir" path="res://resource/animation/character/monster02_move.aseprite" id="2_h60bf"]
[ext_resource type="Resource" uid="uid://dlaekoamystx3" path="res://config/character_shield/normal.tres" id="3_5w356"]
[ext_resource type="Resource" uid="uid://h1curvk64vm3" path="res://config/character_shield/none.tres" id="4_uyg17"]
[ext_resource type="Resource" uid="uid://cac6mk6g078vn" path="res://config/character_stun/normal.tres" id="6_vlmkd"]
[resource]
@ -15,8 +15,8 @@ sprite_frames = ExtResource("2_h60bf")
sprite_harf_height = 26
sprite_width = 16
move = ExtResource("1_hjl2t")
shield = ExtResource("3_5w356")
shield = ExtResource("4_uyg17")
stun = ExtResource("6_vlmkd")
mp = ExtResource("2_gly3h")
hp_max = 100.0
hp_max = 200.0
attack = 10.0

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 114 B

@ -21,10 +21,10 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -32.0
offset_top = -8.0
offset_right = 32.0
offset_bottom = 8.0
offset_left = -16.0
offset_top = -2.0
offset_right = 16.0
offset_bottom = 2.0
grow_horizontal = 2
grow_vertical = 2
value = 60.0
@ -44,17 +44,13 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -32.0
offset_top = -8.0
offset_right = 32.0
offset_bottom = 8.0
offset_left = -16.0
offset_top = -2.0
offset_right = 16.0
offset_bottom = 2.0
grow_horizontal = 2
grow_vertical = 2
value = 50.0
stretch_margin_left = 10
stretch_margin_top = 10
stretch_margin_right = 10
stretch_margin_bottom = 10
texture_under = ExtResource("2_g5t31")
texture_progress = ExtResource("3_vh1p5")
tint_progress = Color(0, 1, 1, 1)
@ -67,13 +63,12 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 40.0
offset_left = 24.0
offset_top = 8.0
offset_right = 104.0
offset_bottom = 24.0
offset_right = 56.0
offset_bottom = 12.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(1, 0.439999)
value = 50.0
stretch_margin_left = 10
stretch_margin_top = 10
@ -91,13 +86,12 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 40.0
offset_top = 24.0
offset_right = 104.0
offset_bottom = 40.0
offset_left = 24.0
offset_top = 16.0
offset_right = 56.0
offset_bottom = 20.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(1, 0.439999)
value = 50.0
stretch_margin_left = 10
stretch_margin_top = 10
@ -114,13 +108,12 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 40.0
offset_top = 16.0
offset_right = 104.0
offset_bottom = 32.0
offset_left = 24.0
offset_top = 12.0
offset_right = 56.0
offset_bottom = 16.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(1, 0.439999)
value = 50.0
stretch_margin_left = 10
stretch_margin_top = 10
@ -133,9 +126,9 @@ tint_progress = Color(0.0941176, 1, 0.992157, 1)
[node name="PosLabel" type="Label" parent="."]
unique_name_in_owner = true
layout_mode = 0
offset_left = 40.0
offset_left = 24.0
offset_top = -8.0
offset_right = 96.0
offset_right = 80.0
offset_bottom = 6.0
theme_override_font_sizes/font_size = 10
text = "123,123"

@ -24,17 +24,17 @@ func attack():
attack_index = len(attack_list) - 1
var attack = attack_list[attack_index] as AttackCfg
var enemy_list = Global.character_mgr.get_enemy_list(character.id())
for enemy in enemy_list:
var pos = character.pos()
var target_pos = enemy.pos()
var target_radius = enemy.radius()
var target_height = enemy.height()
var attack_dir = status.skill_dir.normalized()
var attack_height = attack.height
var attack_size = attack.size
var attack_radius = attack.radius
var offset_xz = attack_dir * attack.offset.x
pos += Vector3(offset_xz.x,attack.offset.y,offset_xz.y)
for enemy in enemy_list:
var target_pos = enemy.pos()
var target_radius = enemy.radius()
var target_height = enemy.height()
if Util.attack_detection(pos,target_pos,target_radius,target_height,attack_dir,attack_height,attack_size,attack_radius):
var hit_info = HitInfo.new()
hit_info.from = character.id()

@ -21,6 +21,7 @@ func init(id:int,cfg:CharacterCfg,team:Enum.ETeam):
collision.scale = body_scale
status.basic_offset = Vector3(0,half_height,0)
status.ui_offset = Vector3(0,height*1.1,0)
status.ui_center_offset = Vector3(0,half_height,0)
status.radius = width
status.height = height
view.init(cfg.sprite_frames)
@ -29,16 +30,16 @@ func init(id:int,cfg:CharacterCfg,team:Enum.ETeam):
func init_after():
var cfg = status.cfg as CharacterCfg
set_status("hp",cfg.hp_max)
set_status("hp_max",cfg.hp_max)
set_status("shield",cfg.shield.shield_max)
set_status("hp",cfg.hp_max)
set_status("shield_max",cfg.shield.shield_max)
set_status("stun",0)
set_status("shield",cfg.shield.shield_max)
set_status("stun_max",cfg.stun.stun_max)
set_status("mp",0)
set_status("stun",0)
set_status("mp_max",cfg.mp.mp_max)
set_status("mp_sub",0)
set_status("mp",0)
set_status("mp_sub_max",cfg.mp.mp_sub_max)
set_status("mp_sub",0)
func set_material(material:ShaderMaterial):
view.material_override = material
@ -71,6 +72,7 @@ func radius()->float:return status.radius
func height()->float:return status.height
func view_pos()->Vector3:return position + view.position
func ui_pos()->Vector3:return position + status.ui_offset
func ui_pos_center()->Vector3:return position + status.ui_center_offset
#==interface==
func get_status(status_name:String):return status.get_status(status_name)

@ -29,6 +29,7 @@ class_name Status
@export var basic_offset : Vector3 #基本偏移值
@export var shake_offset : Vector3 #抖动偏移值
@export var ui_offset : Vector3 #ui挂点偏移值
@export var ui_center_offset : Vector3 #ui中心挂点偏移值
@export var is_pause : bool #是否暂停
@export var flash_white_rate : float #闪白比例
@export var deformation_dir : Vector2 #形变方向

@ -14,7 +14,7 @@ var hit_text_damage_cache : HitText
func on_hp_changed(value):hp_bar.value = value
func on_hp_max_changed(value):hp_bar.max_value = value
func on_shield_changed(value):shield_bar.value = value
func on_shield_changed(value):shield_bar.value = value;shield_bar.visible = value > 0
func on_shield_max_changed(value):shield_bar.max_value = value
func on_stun_changed(value):stun_bar.value = value
func on_stun_max_changed(value):stun_bar.max_value = value

@ -25,8 +25,8 @@ func _process(delta):
headbar_meta.headbar.position = camera.get_screen_pos(headbar_meta.pos)
func on_character_create(id:int,team:Enum.ETeam,pos:Vector3):
#if team == Enum.ETeam.Player:
# return
if team == Enum.ETeam.Player:
return
var new_headbar_meta = HeadbarMeta.new()
new_headbar_meta.pos = pos
var new_headbar = headbar_scene.instantiate()

@ -4,25 +4,20 @@ class_name LockItem
@onready var animation = $AnimationPlayer as AnimationPlayer
@onready var camera: CameraManager = Global.camera_mgr
var target_id : int
var target : Character
var target_pos : Vector3
func _ready():
SignalManager.character_ui_pos_changed.connect(on_character_ui_pos_changed)
SignalManager.character_target_changed.connect(on_character_target_changed)
visible = false
animation.play("rotate")
func on_character_ui_pos_changed(id:int,pos:Vector3):
if id != target_id:
return
position = camera.get_screen_pos(pos)
func _process(delta):
if target:
position = camera.get_screen_pos(target.ui_pos_center())
func on_character_target_changed(id:int,target:int):
func on_character_target_changed(id:int,target_id:int):
if id != Global.character_mgr.get_player_id():
return
var character_target = Global.character_mgr.get_character(target)
target_id = target
if not character_target:
visible = false
return
visible = true
position = camera.get_screen_pos(character_target.ui_pos())
target = Global.character_mgr.get_character(target_id)
visible = target != null

Loading…
Cancel
Save