diff --git a/DungeonShooting_Godot/prefab/ui/Debugger.tscn b/DungeonShooting_Godot/prefab/ui/Debugger.tscn
index cf76f5b..fcd8420 100644
--- a/DungeonShooting_Godot/prefab/ui/Debugger.tscn
+++ b/DungeonShooting_Godot/prefab/ui/Debugger.tscn
@@ -68,3 +68,14 @@
icon = ExtResource("2_acjpv")
flat = true
icon_alignment = 1
+
+[node name="Fps" type="Label" parent="."]
+layout_mode = 1
+anchors_preset = 5
+anchor_left = 0.5
+anchor_right = 0.5
+offset_left = -4.5
+offset_right = 4.5
+offset_bottom = 40.0
+grow_horizontal = 2
+text = "FPS:60"
diff --git a/DungeonShooting_Godot/resource/sprite/weapon/weapon0009/weapon0009.png b/DungeonShooting_Godot/resource/sprite/weapon/weapon0009/weapon0009.png
index 78f9343..e9b8780 100644
--- a/DungeonShooting_Godot/resource/sprite/weapon/weapon0009/weapon0009.png
+++ b/DungeonShooting_Godot/resource/sprite/weapon/weapon0009/weapon0009.png
Binary files differ
diff --git a/DungeonShooting_Godot/scene/Main.tscn b/DungeonShooting_Godot/scene/Main.tscn
index 877b1ff..080a8f2 100644
--- a/DungeonShooting_Godot/scene/Main.tscn
+++ b/DungeonShooting_Godot/scene/Main.tscn
@@ -47,8 +47,6 @@
[node name="SceneRoot" type="Node2D" parent="ViewCanvas/SubViewportContainer/SubViewport"]
[node name="Camera2D" type="Camera2D" parent="ViewCanvas/SubViewportContainer/SubViewport"]
-process_callback = 0
-limit_smoothed = true
editor_draw_drag_margin = true
script = ExtResource("2_2j367")
diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
index 9a4c19b..eeff1fd 100644
--- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
+++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs
@@ -1007,8 +1007,11 @@
_prevAnimation = anim;
_prevAnimationFrame = frame;
- //计算阴影
- CalcShadowTransform();
+ if (_freezeSprite == null || !_freezeSprite.IsFrozen)
+ {
+ //计算阴影
+ CalcShadowTransform();
+ }
}
// Hit 动画
diff --git a/DungeonShooting_Godot/src/framework/map/image/FreezeSprite.cs b/DungeonShooting_Godot/src/framework/map/image/FreezeSprite.cs
index 1a4547d..34a035c 100644
--- a/DungeonShooting_Godot/src/framework/map/image/FreezeSprite.cs
+++ b/DungeonShooting_Godot/src/framework/map/image/FreezeSprite.cs
@@ -83,7 +83,6 @@
var staticSprite = affiliationArea.RoomInfo.StaticSprite;
ActivityObject.ShadowSprite.Reparent(staticSprite);
ActivityObject.AnimatedSprite.Reparent(staticSprite);
- ActivityObject.ShadowSprite.Rotation = ActivityObject.AnimatedSprite.Rotation;
_parent = ActivityObject.GetParent();
_parent.RemoveChild(ActivityObject);
}
@@ -91,7 +90,7 @@
public void HandlerUnfreezeSprite()
{
IsFrozen = false;
- _parent.AddChild(ActivityObject);
+ _parent.CallDeferred(Node.MethodName.AddChild, ActivityObject);
ActivityObject.ShadowSprite.Reparent(_shadowParent);
ActivityObject.AnimatedSprite.Reparent(_spriteParent);
diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs
index cdffdd6..3769340 100644
--- a/DungeonShooting_Godot/src/game/GameApplication.cs
+++ b/DungeonShooting_Godot/src/game/GameApplication.cs
@@ -36,9 +36,14 @@
/// 是否开启调试
///
[ExportGroup("Debug")]
- [Export] public bool Debug;
+ [Export] public bool IsDebug;
///
+ /// 游戏目标帧率
+ ///
+ public int TargetFps { get; private set; } = 60;
+
+ ///
/// 鼠标指针
///
public Cursor Cursor { get; private set; }
@@ -84,6 +89,7 @@
public GameApplication()
{
Instance = this;
+ TargetFps = (int)DisplayServer.ScreenGetRefreshRate();
//初始化配置表
ExcelConfig.Init();
@@ -106,11 +112,10 @@
//随机化种子
//GD.Randomize();
//固定帧率
- Engine.MaxFps = 60;
+ //Engine.MaxFps = TargetFps;
//调试绘制开关
- ActivityObject.IsDebug = Debug;
+ ActivityObject.IsDebug = IsDebug;
//Engine.TimeScale = 0.2f;
-
//调整窗口分辨率
OnWindowSizeChanged();
RefreshSubViewportSize();
diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
index 8e20c50..28058f4 100644
--- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
+++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs
@@ -973,7 +973,7 @@
_continuousCount = _continuousCount > 0 ? _continuousCount - 1 : 0;
}
- //开火间隙
+ //开火间隙, 这里的60指的是60秒
_fireInterval = 60 / Attribute.StartFiringSpeed;
//攻击冷却
_attackTimer += _fireInterval;
diff --git a/DungeonShooting_Godot/src/game/camera/GameCamera.cs b/DungeonShooting_Godot/src/game/camera/GameCamera.cs
index ba37e95..27827a8 100644
--- a/DungeonShooting_Godot/src/game/camera/GameCamera.cs
+++ b/DungeonShooting_Godot/src/game/camera/GameCamera.cs
@@ -74,8 +74,9 @@
{
_camPos = GlobalPosition;
}
-
- public override void _Process(double delta)
+
+ //_PhysicsProcess
+ public override void _PhysicsProcess(double delta)
{
var newDelta = (float)delta;
_Shake(newDelta);
@@ -95,23 +96,20 @@
{
var mousePosition = InputManager.CursorPosition;
var targetPosition = _followTarget.GlobalPosition;
- Vector2 targetPos;
//if (targetPosition.DistanceSquaredTo(mousePosition) >= 39999.992F) // >= (60 / 0.3f) * (60 / 0.3f)
if (targetPosition.DistanceSquaredTo(mousePosition) >= (60 / FollowsMouseAmount) * (60 / FollowsMouseAmount))
{
- targetPos = targetPosition.MoveToward(mousePosition, 60);
+ _camPos = targetPosition.MoveToward(mousePosition, 60);
}
else
{
//targetPos = targetPosition.Lerp(mousePosition, 0.3f); //这里的0.3就是上面的 (60 / 0.3f) * (60 / 0.3f) 中的 0.3
- targetPos = targetPosition.Lerp(mousePosition, FollowsMouseAmount);
+ _camPos = targetPosition.Lerp(mousePosition, FollowsMouseAmount);
}
- _camPos = _camPos.Lerp(targetPos, 20 * newDelta);
+ //_camPos = _camPos.Lerp(targetPos, 20 * newDelta);
GlobalPosition = _camPos.Round();
Offset = _shakeOffset.Round();
-
- //_temp = _camPos - targetPosition;
//调用相机更新事件
if (OnPositionUpdateEvent != null)
diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs
index 46871a4..c83bbf3 100644
--- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs
+++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs
@@ -185,7 +185,7 @@
//更新敌人视野
UpdateEnemiesView();
- if (GameApplication.Instance.Debug)
+ if (GameApplication.Instance.IsDebug)
{
QueueRedraw();
}
@@ -651,7 +651,7 @@
public override void _Draw()
{
- if (GameApplication.Instance.Debug)
+ if (GameApplication.Instance.IsDebug)
{
if (_dungeonTileMap != null && _roomStaticNavigationList != null)
{
diff --git a/DungeonShooting_Godot/src/game/ui/bottomTips/BottomTipsPanel.cs b/DungeonShooting_Godot/src/game/ui/bottomTips/BottomTipsPanel.cs
index ff23c3e..a7bba64 100644
--- a/DungeonShooting_Godot/src/game/ui/bottomTips/BottomTipsPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/bottomTips/BottomTipsPanel.cs
@@ -69,7 +69,7 @@
yield return 0;
//向上移动
- var frame = 60 * _animationTime;
+ var frame = GameApplication.Instance.TargetFps * _animationTime;
var stepPixel = _movePixel / frame;
for (var i = 0; i < frame; i++)
{
diff --git a/DungeonShooting_Godot/src/game/ui/debugger/Debugger.cs b/DungeonShooting_Godot/src/game/ui/debugger/Debugger.cs
index e63e0d4..f663a64 100644
--- a/DungeonShooting_Godot/src/game/ui/debugger/Debugger.cs
+++ b/DungeonShooting_Godot/src/game/ui/debugger/Debugger.cs
@@ -31,6 +31,19 @@
}
private HoverButton _L_HoverButton;
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Debugger.Fps
+ ///
+ public Fps L_Fps
+ {
+ get
+ {
+ if (_L_Fps == null) _L_Fps = new Fps((DebuggerPanel)this, GetNode("Fps"));
+ return _L_Fps;
+ }
+ }
+ private Fps _L_Fps;
+
public Debugger() : base(nameof(Debugger))
{
@@ -147,6 +160,15 @@
public override HoverButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
}
+ ///
+ /// 类型: , 路径: Debugger.Fps
+ ///
+ public class Fps : UiNode
+ {
+ public Fps(DebuggerPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override Fps Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: Debugger.Bg.Clear
@@ -178,4 +200,9 @@
///
public HoverButton S_HoverButton => L_HoverButton;
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: Debugger.Fps
+ ///
+ public Fps S_Fps => L_Fps;
+
}
diff --git a/DungeonShooting_Godot/src/game/ui/debugger/DebuggerPanel.cs b/DungeonShooting_Godot/src/game/ui/debugger/DebuggerPanel.cs
index 68d13f4..62c13bb 100644
--- a/DungeonShooting_Godot/src/game/ui/debugger/DebuggerPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/debugger/DebuggerPanel.cs
@@ -51,6 +51,8 @@
}
}
}
+
+ S_Fps.Instance.Text = "FPS:" + Engine.GetFramesPerSecond();
}
private void OnMouseDown()
diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs
index 85eb7da..3203984 100644
--- a/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs
+++ b/DungeonShooting_Godot/src/game/ui/roomUI/InteractiveTipBar.cs
@@ -46,7 +46,7 @@
/// 显示图标
public void ShowBar(ActivityObject target, string showText, Texture2D icon)
{
- _interactiveTipBar.Instance.GlobalPosition = target.GlobalPosition;
+ _interactiveTipBar.Instance.GlobalPosition = GameApplication.Instance.ViewToGlobalPosition(_interactiveTarget.GlobalPosition);
_interactiveTipBar.L_Icon.Instance.Texture = icon;
_interactiveTipBar.Instance.Visible = true;
_interactiveTipBar.L_NameLabel.Instance.Text = showText;