diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot
index da8e0c9..8f16079 100644
--- a/DungeonShooting_Godot/project.godot
+++ b/DungeonShooting_Godot/project.godot
@@ -21,8 +21,8 @@
[display]
-window/size/viewport_width=1280
-window/size/viewport_height=720
+window/size/viewport_width=1920
+window/size/viewport_height=1080
window/stretch/aspect="keep_width"
window/vsync/use_vsync=false
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png
index e502322..d64d95a 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Preview.png
Binary files differ
diff --git a/DungeonShooting_Godot/src/framework/activity/Component.cs b/DungeonShooting_Godot/src/framework/activity/Component.cs
index 2837a48..a33d5e2 100644
--- a/DungeonShooting_Godot/src/framework/activity/Component.cs
+++ b/DungeonShooting_Godot/src/framework/activity/Component.cs
@@ -141,14 +141,14 @@
{
if (!_enable && value)
{
+ _enable = true;
OnEnable();
}
else if (_enable && !value)
{
+ _enable = false;
OnDisable();
}
-
- _enable = value;
}
}
diff --git a/DungeonShooting_Godot/src/game/activity/role/SubLine.cs b/DungeonShooting_Godot/src/game/activity/role/SubLine.cs
index 58f21e2..33bd409 100644
--- a/DungeonShooting_Godot/src/game/activity/role/SubLine.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/SubLine.cs
@@ -2,27 +2,35 @@
using System.Collections;
using Godot;
+///
+/// 瞄准辅助线
+///
public class SubLine : Component
{
+ ///
+ /// 是否正在播放警告闪烁动画
+ ///
+ public bool IsPlayWarnAnimation => _cid > 0;
+
private Line2D _line2D;
private RayCast2D _rayCast2D;
private bool _enableSubLine;
private float _range;
private long _cid;
+ private Color _color = Colors.Orange;
public override void Ready()
{
//初始化瞄准辅助线
_line2D = new Line2D();
_line2D.Width = 1;
- _line2D.DefaultColor = Colors.Orange;
AddChild(_line2D);
_rayCast2D = new RayCast2D();
_rayCast2D.CollisionMask = PhysicsLayer.Wall;
AddChild(_rayCast2D);
-
+
Master.WeaponPack.ChangeActiveItemEvent += OnChangeWeapon;
}
@@ -42,29 +50,50 @@
}
}
+ ///
+ /// 设置线条颜色
+ ///
public void SetColor(Color color)
{
+ _color = color;
_line2D.DefaultColor = color;
}
+ ///
+ /// 播放闪烁警告动画
+ ///
+ /// 持续时间
public void PlayWarnAnimation(float time)
{
if (_cid > 0)
{
StopCoroutine(_cid);
}
-
+
_cid = StartCoroutine(RunWarnAnimation(time));
}
private IEnumerator RunWarnAnimation(float time)
{
var now = 0f;
+ var t = 0f;
+ var b = false;
while (now < time)
{
- now += GetProcessDeltaTime();
+ var delta = GetProcessDeltaTime();
+ now += delta;
+ t += delta;
+ if (t >= 0.08f)
+ {
+ t %= 0.08f;
+ _line2D.DefaultColor = b ? Colors.Orange : Colors.Red;
+ b = !b;
+ }
yield return null;
}
+
+ _line2D.DefaultColor = _color;
+ _cid = 0;
}
//切换武器
@@ -84,8 +113,10 @@
if (_cid > 0)
{
StopCoroutine(_cid);
+ _cid = 0;
}
_range = Utils.GetConfigRangeEnd(weapon.Attribute.BulletDistanceRange);
+ _line2D.DefaultColor = _color;
}
}
diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
index 684d124..1a4017c 100644
--- a/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
+++ b/DungeonShooting_Godot/src/game/activity/role/enemy/Enemy.cs
@@ -168,7 +168,7 @@
}
//更新瞄准辅助线
- if (AttackState == AiAttackState.LockingTime)
+ if (weapon.Attribute.AiAttackAttr.ShowSubline && AttackState == AiAttackState.LockingTime)
{
if (SubLine == null)
{
@@ -179,13 +179,10 @@
SubLine.Enable = true;
}
- if (weapon.GetAiLockRemainderTime() > 0.4f)
+ //播放警告删掉动画
+ if (!SubLine.IsPlayWarnAnimation && weapon.GetAiLockRemainderTime() <= 0.5f)
{
- SubLine.SetColor(Colors.Orange);
- }
- else
- {
- SubLine.SetColor(Colors.Red);
+ SubLine.PlayWarnAnimation(0.5f);
}
}
else if (SubLine != null)