diff --git a/DungeonShooting_Godot/excel/BulletBase.xlsx b/DungeonShooting_Godot/excel/BulletBase.xlsx index 65ac36d..36db767 100644 --- a/DungeonShooting_Godot/excel/BulletBase.xlsx +++ b/DungeonShooting_Godot/excel/BulletBase.xlsx Binary files differ diff --git a/DungeonShooting_Godot/resource/config/BulletBase.json b/DungeonShooting_Godot/resource/config/BulletBase.json index de64482..b22074a 100644 --- a/DungeonShooting_Godot/resource/config/BulletBase.json +++ b/DungeonShooting_Godot/resource/config/BulletBase.json @@ -330,15 +330,15 @@ 0 ], "SpeedRange": [ - 450, - 480 + 400, + 400 ], "LifeTimeRange": [ -1 ], "DistanceRange": [ - 300, - 350 + 50, + 50 ], "VerticalSpeed": [ 0 diff --git a/DungeonShooting_Godot/src/framework/common/Utils.cs b/DungeonShooting_Godot/src/framework/common/Utils.cs index dd91a38..be6cc8e 100644 --- a/DungeonShooting_Godot/src/framework/common/Utils.cs +++ b/DungeonShooting_Godot/src/framework/common/Utils.cs @@ -50,36 +50,6 @@ { return (mask & layer) != 0; } - - /// - /// 使用定的 canvasItem 绘制导航区域, 注意, 该函数只能在 draw 函数中调用 - /// - public static void DrawNavigationPolygon(CanvasItem canvasItem, NavigationPolygonData[] polygonData, float width = 1) - { - for (var i = 0; i < polygonData.Length; i++) - { - var item = polygonData[i]; - var points = item.GetPoints(); - if (points.Length>= 2) - { - var array = new Vector2[points.Length + 1]; - for (var j = 0; j < points.Length; j++) - { - array[j] = points[j]; - } - - array[array.Length - 1] = points[0]; - if (item.Type == NavigationPolygonType.In) - { - canvasItem.DrawPolyline(points, Colors.Orange, width); - } - else - { - canvasItem.DrawPolyline(points, Colors.Orange, width); - } - } - } - } /// /// 将一个任意角度转为0到360度 diff --git a/DungeonShooting_Godot/src/framework/map/DoorNavigationInfo.cs b/DungeonShooting_Godot/src/framework/map/DoorNavigationInfo.cs deleted file mode 100644 index 21651c2..0000000 --- a/DungeonShooting_Godot/src/framework/map/DoorNavigationInfo.cs +++ /dev/null @@ -1,40 +0,0 @@ - -using Godot; - -/// -/// 房间连接门的站位导航数据 -/// -public class DoorNavigationInfo -{ - public DoorNavigationInfo(RoomDoorInfo doorInfo, NavigationPolygonData openNavigationData, NavigationPolygonData closeNavigationData) - { - DoorInfo = doorInfo; - OpenNavigationData = openNavigationData; - CloseNavigationData = closeNavigationData; - } - - /// - /// 绑定的门对象 - /// - public RoomDoorInfo DoorInfo; - - /// - /// 门开启时导航区域节点 - /// - public NavigationRegion2D OpenNavigationNode; - - /// - /// 门关闭时导航区域节点 - /// - public NavigationRegion2D CloseNavigationNode; - - /// - /// 门开启时导航形状数据 - /// - public NavigationPolygonData OpenNavigationData; - - /// - /// 门关闭时导航形状数据 - /// - public NavigationPolygonData CloseNavigationData; -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs b/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs index a03378a..c346f93 100644 --- a/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs @@ -61,11 +61,6 @@ public Vector2I Cross; /// - /// 占位导航网格 - /// - public DoorNavigationInfo Navigation; - - /// /// 连接过道使用预览纹理, 用于小地图 /// public ImageTexture AislePreviewTexture; diff --git a/DungeonShooting_Godot/src/framework/map/serialize/room/NavigationPolygonData.cs b/DungeonShooting_Godot/src/framework/map/serialize/room/NavigationPolygonData.cs deleted file mode 100644 index 460e2b2..0000000 --- a/DungeonShooting_Godot/src/framework/map/serialize/room/NavigationPolygonData.cs +++ /dev/null @@ -1,81 +0,0 @@ - -using System.Collections.Generic; -using System.Text.Json.Serialization; -using Godot; - -public enum NavigationPolygonType -{ - /// - /// 外轮廓 - /// - Out, - /// - /// 内轮廓 - /// - In, -} - -/// -/// 描述导航多边形数据 -/// -public class NavigationPolygonData -{ - /// - /// 导航轮廓类型 - /// - [JsonInclude] - public NavigationPolygonType Type; - - /// - /// 多边形的顶点, 两个为一组, 单位: 像素, 需要获取转为 Vector2[] 的值请调用 GetPoints() 函数 - /// - [JsonInclude] - public List Points; - - private Vector2[] _pointVector2Array; - - public NavigationPolygonData() - { - } - - public NavigationPolygonData(NavigationPolygonType type) - { - Type = type; - } - - /// - /// 读取所有的坐标点, 单位: 像素 - /// - public Vector2[] GetPoints() - { - if (_pointVector2Array == null) - { - if (Points == null) - { - return null; - } - - _pointVector2Array = new Vector2[Points.Count / 2]; - for (var i = 0; i < Points.Count; i += 2) - { - _pointVector2Array[i / 2] = new Vector2(Points[i], Points[i + 1]); - } - } - - return _pointVector2Array; - } - - /// - /// 设置所有的坐标点 - /// - public void SetPoints(Vector2[] array) - { - _pointVector2Array = array; - Points = new List(); - foreach (var pos in array) - { - Points.Add(pos.X); - Points.Add(pos.Y); - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/activity/bullet/normal/Arrow.cs b/DungeonShooting_Godot/src/game/activity/bullet/normal/Arrow.cs index 7cf187e..d90c7f7 100644 --- a/DungeonShooting_Godot/src/game/activity/bullet/normal/Arrow.cs +++ b/DungeonShooting_Godot/src/game/activity/bullet/normal/Arrow.cs @@ -37,13 +37,53 @@ return base.CheckInteractive(master); } + public override void OnPlayDisappearEffect() + { + } + + protected override void OnArea2dEntered(Area2D other) + { + if (Velocity.Length() >= BulletData.FlySpeed / 2f) + { + base.OnArea2dEntered(other); + } + } + + protected override void OnBodyEntered(Node2D body) + { + if (Velocity.Length() >= BulletData.FlySpeed / 2f) + { + base.OnBodyEntered(body); + } + } + public override void OnCollisionTarget(IHurt hurt) { base.OnCollisionTarget(hurt); - var activityObject = hurt.GetActivityObject(); - if (activityObject != null) + if (CurrentPenetration > BulletData.Penetration) { - CallDeferred(nameof(OnBindTarget), activityObject); + var activityObject = hurt.GetActivityObject(); + if (activityObject != null) + { + CallDeferred(nameof(OnBindTarget), activityObject); + } + } + } + + public override void OnMoveCollision(KinematicCollision2D collision) + { + if (Velocity.Length() >= BulletData.FlySpeed / 2f) + { + base.OnMoveCollision(collision); + } + } + + protected override void OnThrowOver() + { + SetOriginCollisionLayerValue(PhysicsLayer.Prop, true); + if (!Utils.CollisionMaskWithLayer(CollisionLayer, PhysicsLayer.Prop)) + { + CollisionLayer |= PhysicsLayer.Prop; } } @@ -58,6 +98,10 @@ Position -= slideCollision.GetTravel(); } } + else if (State == BulletStateEnum.MaxDistance) //到达最大动力距离, 则开始下坠 + { + EnableVerticalMotion = true; + } else if (State == BulletStateEnum.FallToGround) //落地, 啥也不干 { @@ -72,7 +116,7 @@ //将弓箭挂载到目标物体上 private void OnBindTarget(ActivityObject activityObject) { - if (activityObject.IsDestroyed) + if (activityObject.IsDestroyed) //目标已经销毁 { OnUnmount(activityObject); } @@ -88,11 +132,11 @@ Reparent(target); AnimatedSprite.Play(AnimatorNames.HalfEnd); HalfSprite.Visible = true; + EnableVerticalMotion = false; } public void OnUnmount(ActivityObject target) { - SetOriginCollisionLayerValue(PhysicsLayer.Prop, true); AnimatedSprite.Play(AnimatorNames.Default); HalfSprite.Visible = false; SetEnableMovement(true); diff --git a/DungeonShooting_Godot/src/game/room/RoomDoor.cs b/DungeonShooting_Godot/src/game/room/RoomDoor.cs index 8059b62..28f9177 100644 --- a/DungeonShooting_Godot/src/game/room/RoomDoor.cs +++ b/DungeonShooting_Godot/src/game/room/RoomDoor.cs @@ -67,13 +67,6 @@ IsClose = true; //Visible = true; Collision.Disabled = false; - if (_door.Navigation != null) - { - _door.Navigation.OpenNavigationNode.Enabled = false; - _door.Navigation.OpenNavigationNode.Visible = false; - _door.Navigation.CloseNavigationNode.Enabled = true; - _door.Navigation.CloseNavigationNode.Visible = true; - } if (AnimatedSprite.SpriteFrames.HasAnimation(AnimatorNames.CloseDoor)) { @@ -125,13 +118,6 @@ private void OpenDoorHandler() { Collision.Disabled = true; - if (_door.Navigation != null) - { - _door.Navigation.OpenNavigationNode.Enabled = true; - _door.Navigation.OpenNavigationNode.Visible = true; - _door.Navigation.CloseNavigationNode.Enabled = false; - _door.Navigation.CloseNavigationNode.Visible = false; - } //调整门的层级 //ZIndex = MapLayer.AutoFloorLayer;