diff --git a/DungeonShooting_Godot/prefab/role/Role.tscn b/DungeonShooting_Godot/prefab/role/Role.tscn index 1b76c68..5579607 100644 --- a/DungeonShooting_Godot/prefab/role/Role.tscn +++ b/DungeonShooting_Godot/prefab/role/Role.tscn @@ -78,7 +78,7 @@ [node name="Role" type="Node"] script = ExtResource( 2 ) -ZIndex = 3 +ZIndex = 1 [node name="ShadowSprite" type="Sprite" parent="."] material = ExtResource( 1 ) diff --git a/DungeonShooting_Godot/src/framework/ActivityObject.cs b/DungeonShooting_Godot/src/framework/ActivityObject.cs index 8e24ba1..5f5754b 100644 --- a/DungeonShooting_Godot/src/framework/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/ActivityObject.cs @@ -53,7 +53,6 @@ var body = tempNode.GetChild(0); tempNode.RemoveChild(body); AddChild(body); - switch (body.Name) { case "AnimatedSprite": diff --git a/DungeonShooting_Godot/src/game/role/Role.cs b/DungeonShooting_Godot/src/game/role/Role.cs index b3fc853..577a7d6 100644 --- a/DungeonShooting_Godot/src/game/role/Role.cs +++ b/DungeonShooting_Godot/src/game/role/Role.cs @@ -9,17 +9,17 @@ /// /// 重写的纹理 /// - [Export] public Texture Texture; + public Texture Texture { get; protected set; } /// /// 移动速度 /// - [Export] public float MoveSpeed = 150f; + public float MoveSpeed = 150f; /// /// 所属阵营 /// - [Export] public CampEnum Camp; + public CampEnum Camp; /// /// 携带的道具包裹 @@ -123,10 +123,13 @@ StartScele = Scale; MountPoint = GetNode("MountPoint"); BackMountPoint = GetNode("BackMountPoint"); - // 更改纹理 - ChangeFrameTexture(AnimatorNames.Idle, AnimatedSprite, Texture); - ChangeFrameTexture(AnimatorNames.Run, AnimatedSprite, Texture); - ChangeFrameTexture(AnimatorNames.ReverseRun, AnimatedSprite, Texture); + if (Texture != null) + { + // 更改纹理 + ChangeFrameTexture(AnimatorNames.Idle, AnimatedSprite, Texture); + ChangeFrameTexture(AnimatorNames.Run, AnimatedSprite, Texture); + ChangeFrameTexture(AnimatorNames.ReverseRun, AnimatedSprite, Texture); + } Holster = new Holster(this); Face = FaceDirection.Right; @@ -288,7 +291,7 @@ /// private void ChangeFrameTexture(string anim, AnimatedSprite animatedSprite, Texture texture) { - SpriteFrames spriteFrames = animatedSprite.Frames as SpriteFrames; + SpriteFrames spriteFrames = animatedSprite.Frames; if (spriteFrames != null) { int count = spriteFrames.GetFrameCount(anim);