diff --git a/DungeonShooting_Godot/prefab/map/RoomDoor.tscn b/DungeonShooting_Godot/prefab/map/RoomDoor.tscn index 62b49d4..cbe5556 100644 --- a/DungeonShooting_Godot/prefab/map/RoomDoor.tscn +++ b/DungeonShooting_Godot/prefab/map/RoomDoor.tscn @@ -28,9 +28,11 @@ }] [sub_resource type="RectangleShape2D" id="RectangleShape2D_xgcls"] +size = Vector2(26, 26) [node name="RoomDoor" type="Node"] script = ExtResource("1_8es7a") +collision_layer = 1 z_index = 15 [node name="ShadowSprite" type="Sprite2D" parent="."] @@ -39,7 +41,7 @@ [node name="AnimatedSprite" type="AnimatedSprite2D" parent="."] material = SubResource("ShaderMaterial_f8vun") -scale = Vector2(0.3125, 0.3125) +scale = Vector2(0.40625, 0.40625) sprite_frames = SubResource("SpriteFrames_ugstb") [node name="Collision" type="CollisionShape2D" parent="."] diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index 3614f64..a9e7a25 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -331,10 +331,11 @@ } /// - /// 将一个节点扔到地上, 并设置显示的阴影 + /// 将一个节点扔到地上 /// 放入的层 + /// 是否显示阴影 /// - public virtual void PutDown(RoomLayerEnum layer) + public virtual void PutDown(RoomLayerEnum layer, bool showShadow = true) { _currLayer = layer; var parent = GetParent(); @@ -349,14 +350,21 @@ this.AddToActivityRoot(layer); } - if (IsInsideTree()) + if (showShadow) { - ShowShadowSprite(); + if (IsInsideTree()) + { + ShowShadowSprite(); + } + else + { + //注意需要延时调用 + CallDeferred(nameof(ShowShadowSprite)); + } } else { - //注意需要延时调用 - CallDeferred(nameof(ShowShadowSprite)); + ShadowSprite.Visible = false; } } diff --git a/DungeonShooting_Godot/src/framework/map/DungeonTile.cs b/DungeonShooting_Godot/src/framework/map/DungeonTile.cs index 6ca7602..7b6d0fc 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonTile.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonTile.cs @@ -143,50 +143,47 @@ var doorDir2 = doorInfo.ConnectDoor.Direction; if (!doorInfo.HasCross) { - //方向, 0横向, 1纵向 - int dir = 0; var rect = Utils.CalcRect( doorInfo.OriginPosition.X, doorInfo.OriginPosition.Y, doorInfo.ConnectDoor.OriginPosition.X, doorInfo.ConnectDoor.OriginPosition.Y ); - if (doorDir1 == DoorDirection.N || doorDir1 == DoorDirection.S) - { - rect.Size = new Vector2(GenerateDungeon.CorridorWidth, rect.Size.Y); - dir = 1; - } - else - { - rect.Size = new Vector2(rect.Size.X, GenerateDungeon.CorridorWidth); - } - if (dir == 0) //横向 + switch (doorDir1) { - FullHorizontalAisle(config, rect); + case DoorDirection.E: + rect.Size = new Vector2(rect.Size.X, GenerateDungeon.CorridorWidth); + FullHorizontalAisle(config, rect); + FullHorizontalAisleLeft(config, rect, doorInfo); + FullHorizontalAisleRight(config, rect, doorInfo.ConnectDoor); + break; + case DoorDirection.W: + rect.Size = new Vector2(rect.Size.X, GenerateDungeon.CorridorWidth); + FullHorizontalAisle(config, rect); + FullHorizontalAisleLeft(config, rect, doorInfo.ConnectDoor); + FullHorizontalAisleRight(config, rect, doorInfo); + break; - FullHorizontalAisleLeft(config, rect, doorDir1 == DoorDirection.E ? doorInfo : null); - FullHorizontalAisleRight(config, rect, doorDir1 == DoorDirection.W ? doorInfo : null); - - FullHorizontalAisleLeft(config, rect, doorDir2 == DoorDirection.E ? doorInfo.ConnectDoor : null); - FullHorizontalAisleRight(config, rect, doorDir2 == DoorDirection.W ? doorInfo.ConnectDoor : null); - } - else //纵向 - { - FullVerticalAisle(config, rect); - - FullVerticalAisleUp(config, rect, doorDir1 == DoorDirection.S ? doorInfo : null); - FullVerticalAisleDown(config, rect, doorDir1 == DoorDirection.N ? doorInfo : null); - - FullVerticalAisleUp(config, rect, doorDir2 == DoorDirection.S ? doorInfo.ConnectDoor : null); - FullVerticalAisleDown(config, rect, doorDir2 == DoorDirection.N ? doorInfo.ConnectDoor : null); + case DoorDirection.S: + rect.Size = new Vector2(GenerateDungeon.CorridorWidth, rect.Size.Y); + FullVerticalAisle(config, rect); + FullVerticalAisleUp(config, rect, doorInfo); + FullVerticalAisleDown(config, rect, doorInfo.ConnectDoor); + break; + case DoorDirection.N: + rect.Size = new Vector2(GenerateDungeon.CorridorWidth, rect.Size.Y); + FullVerticalAisle(config, rect); + FullVerticalAisleUp(config, rect, doorInfo.ConnectDoor); + FullVerticalAisleDown(config, rect, doorInfo); + break; } } else //带交叉点 { //方向, 0横向, 1纵向 - int dir1 = 0; - int dir2 = 0; + var dir1 = 0; + var dir2 = 0; Rect2 rect; Rect2 rect2; diff --git a/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs index 712d7f5..098bcb9 100644 --- a/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs @@ -957,9 +957,9 @@ AnimationPlayer.Play("floodlight"); } - public override void PutDown(RoomLayerEnum layer) + public override void PutDown(RoomLayerEnum layer, bool showShadow = true) { - base.PutDown(layer); + base.PutDown(layer, showShadow); AnimationPlayer.Play("floodlight"); } diff --git a/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs b/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs index 220101b..a46747e 100644 --- a/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs +++ b/DungeonShooting_Godot/src/game/role/enemy/Enemy.cs @@ -81,7 +81,7 @@ AttackLayer = PhysicsLayer.Wall | PhysicsLayer.Props | PhysicsLayer.Player; Camp = CampEnum.Camp2; - MoveSpeed = 15; + MoveSpeed = 30; Holster.SlotList[2].Enable = true; Holster.SlotList[3].Enable = true; diff --git a/DungeonShooting_Godot/src/game/room/RoomDoor.cs b/DungeonShooting_Godot/src/game/room/RoomDoor.cs index dd78ae2..6eda787 100644 --- a/DungeonShooting_Godot/src/game/room/RoomDoor.cs +++ b/DungeonShooting_Godot/src/game/room/RoomDoor.cs @@ -7,7 +7,7 @@ public void Init(RoomDoorInfo doorInfo) { _door = doorInfo; - //CloseDoor(); + CloseDoor(); } public void OpenDoor() diff --git a/DungeonShooting_Godot/src/game/room/RoomManager.cs b/DungeonShooting_Godot/src/game/room/RoomManager.cs index 2234b22..fc4a42b 100644 --- a/DungeonShooting_Godot/src/game/room/RoomManager.cs +++ b/DungeonShooting_Godot/src/game/room/RoomManager.cs @@ -226,7 +226,7 @@ } door.Position = (doorInfo.OriginPosition + offset) * GenerateDungeon.TileCellSize; door.Init(doorInfo); - door.PutDown(RoomLayerEnum.NormalLayer); + door.PutDown(RoomLayerEnum.NormalLayer, false); } }