diff --git a/DungeonShooting_Godot/prefab/weapon/Weapon.tscn b/DungeonShooting_Godot/prefab/weapon/Weapon.tscn
index ebebb5b..80de07d 100644
--- a/DungeonShooting_Godot/prefab/weapon/Weapon.tscn
+++ b/DungeonShooting_Godot/prefab/weapon/Weapon.tscn
@@ -1,43 +1,28 @@
-[gd_scene load_steps=9 format=2]
+[gd_scene load_steps=8 format=2]
[ext_resource path="res://resource/materlal/Shadow.tres" type="Material" id=1]
[ext_resource path="res://resource/materlal/Shadow.gdshader" type="Shader" id=2]
[ext_resource path="res://addons/dungeonShooting_plugin/ActivityObjectTemplate.cs" type="Script" id=3]
-[sub_resource type="ShaderMaterial" id=9]
+[sub_resource type="ShaderMaterial" id=5]
resource_local_to_scene = true
shader = ExtResource( 2 )
shader_param/shadowColor = Color( 1, 1, 1, 1 )
shader_param/schedule = 0.0
-[sub_resource type="StreamTexture" id=8]
-load_path = "res://.import/gun1.png-f7bc3e27b4b477d47c7353ffb91687ea.stex"
-
[sub_resource type="Animation" id=3]
resource_name = "Floodlight"
length = 3.0
loop = true
step = 0.5
tracks/0/type = "value"
-tracks/0/path = NodePath("WeaponSprite:material:shader_param/shadowColor")
+tracks/0/path = NodePath("../AnimatedSprite:material:shader_param/schedule")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
-"times": PoolRealArray( 0 ),
-"transitions": PoolRealArray( 1 ),
-"update": 0,
-"values": [ Color( 1, 1, 1, 1 ) ]
-}
-tracks/1/type = "value"
-tracks/1/path = NodePath("WeaponSprite:material:shader_param/schedule")
-tracks/1/interp = 1
-tracks/1/loop_wrap = true
-tracks/1/imported = false
-tracks/1/enabled = true
-tracks/1/keys = {
-"times": PoolRealArray( 0, 1.9, 2.4, 2.5, 3 ),
+"times": PoolRealArray( 0, 2, 2.4, 2.5, 3 ),
"transitions": PoolRealArray( 1, 1, 1, 1, 1 ),
"update": 0,
"values": [ 0.0, 0.0, 1.0, 1.0, 0.0 ]
@@ -46,7 +31,7 @@
[sub_resource type="Animation" id=4]
length = 0.001
tracks/0/type = "value"
-tracks/0/path = NodePath("WeaponSprite:material:shader_param/shadowColor")
+tracks/0/path = NodePath("../AnimatedSprite:material:shader_param/schedule")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
@@ -55,18 +40,6 @@
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
-"values": [ Color( 1, 1, 1, 1 ) ]
-}
-tracks/1/type = "value"
-tracks/1/path = NodePath("WeaponSprite:material:shader_param/schedule")
-tracks/1/interp = 1
-tracks/1/loop_wrap = true
-tracks/1/imported = false
-tracks/1/enabled = true
-tracks/1/keys = {
-"times": PoolRealArray( 0 ),
-"transitions": PoolRealArray( 1 ),
-"update": 0,
"values": [ 0.0 ]
}
@@ -79,16 +52,15 @@
[node name="ShadowSprite" type="Sprite" parent="."]
material = ExtResource( 1 )
+[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
+material = SubResource( 5 )
+position = Vector2( 0.4, -2.6 )
+scale = Vector2( 0.8, 0.8 )
+
[node name="WeaponBody" type="Area2D" parent="."]
collision_layer = 4
collision_mask = 0
-[node name="WeaponSprite" type="Sprite" parent="WeaponBody"]
-material = SubResource( 9 )
-position = Vector2( 0.4, -2.6 )
-scale = Vector2( 0.8, 0.8 )
-texture = SubResource( 8 )
-
[node name="AnimationPlayer" type="AnimationPlayer" parent="WeaponBody"]
autoplay = "Floodlight"
playback_process_mode = 0
@@ -108,6 +80,4 @@
position = Vector2( 0.59999, 0.199997 )
shape = SubResource( 1 )
-[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
-
[node name="Collision" type="CollisionShape2D" parent="."]
diff --git a/DungeonShooting_Godot/src/framework/ActivityObject.cs b/DungeonShooting_Godot/src/framework/ActivityObject.cs
index 4580fb2..54f74f9 100644
--- a/DungeonShooting_Godot/src/framework/ActivityObject.cs
+++ b/DungeonShooting_Godot/src/framework/ActivityObject.cs
@@ -101,6 +101,34 @@
ShadowSprite.Visible = false;
}
+ public void SetDefaultTexture(Texture texture)
+ {
+ if (AnimatedSprite.Frames == null)
+ {
+ SpriteFrames spriteFrames = new SpriteFrames();
+ AnimatedSprite.Frames = spriteFrames;
+ spriteFrames.AddFrame("default", texture);
+ }
+ else
+ {
+ SpriteFrames spriteFrames = AnimatedSprite.Frames;
+ spriteFrames.SetFrame("default", 0, texture);
+ }
+
+ AnimatedSprite.Animation = "default";
+ AnimatedSprite.Playing = true;
+ }
+
+ public void GetCurrentTexture()
+ {
+
+ }
+
+ public Texture GetDefaultTexture()
+ {
+ return AnimatedSprite.Frames.GetFrame("default", 0);
+ }
+
///
/// 返回是否能与其他ActivityObject互动
///
diff --git a/DungeonShooting_Godot/src/game/common/NodeExtend.cs b/DungeonShooting_Godot/src/game/common/NodeExtend.cs
index a94a1d2..62e5ed5 100644
--- a/DungeonShooting_Godot/src/game/common/NodeExtend.cs
+++ b/DungeonShooting_Godot/src/game/common/NodeExtend.cs
@@ -46,8 +46,7 @@
///
/// 将一个节点扔到地上, 并设置显示的阴影, 函数返回根据该节点创建的 ThrowNode 节点
///
- /// 显示的阴影sprite
- public static ThrowNode PutDown(this ActivityObject node, Sprite shadowTarget)
+ public static ThrowNode PutDown(this ActivityObject node)
{
//return StartThrow(node, Vector2.Zero, node.Position, 0, 0, 0, 0, 0, shadowTarget);
RoomManager.Current.ObjectRoot.AddChild(node);
@@ -84,10 +83,9 @@
var direction = master.GlobalRotationDegrees + MathUtils.RandRangeInt(-20, 20);
var xf = 30;
var yf = MathUtils.RandRangeInt(60, 120);
- var rotate = MathUtils.RandRangeInt(-360, -360);
+ var rotate = MathUtils.RandRangeInt(-180, 180);
weapon.Position = Vector2.Zero;
- return weapon.StartThrow(new Vector2(20, 20), startPos, startHeight, direction, xf, yf, rotate);
- //return weapon.StartThrow(new Vector2(20, 20), startPos, startHeight, direction, xf, yf, rotate, weapon.WeaponSprite);
+ return weapon.StartThrow(new Vector2(20, 20), startPos, startHeight, direction, xf, yf, rotate);
}
diff --git a/DungeonShooting_Godot/src/game/item/throwObject/ThrowComponent.cs b/DungeonShooting_Godot/src/game/item/throwObject/ThrowComponent.cs
index c2b6fee..3ee64b9 100644
--- a/DungeonShooting_Godot/src/game/item/throwObject/ThrowComponent.cs
+++ b/DungeonShooting_Godot/src/game/item/throwObject/ThrowComponent.cs
@@ -49,43 +49,47 @@
///
public float RotateSpeed { get; protected set; }
- //绑定的kinematicBody2D节点
- private KinematicBody2D _kinematicBody2D;
-
- //碰撞器形状
- private CollisionShape2D _collisionShape2D;
-
- private RectangleShape2D _rectangleShape2D;
+ ///
+ /// 绑定的kinematicBody2D节点
+ ///
+ protected KinematicBody2D KinematicBody;
+ ///
+ /// 碰撞器节点
+ ///
+ protected CollisionShape2D CollisionShape;
+ ///
+ /// 碰撞器形状
+ ///
+ protected RectangleShape2D RectangleShape;
public ThrowComponent()
{
- _kinematicBody2D = new KinematicBody2D();
- _kinematicBody2D.Name = nameof(ThrowComponent);
+ KinematicBody = new KinematicBody2D();
+ KinematicBody.Name = nameof(ThrowComponent);
//只与墙壁碰撞
- _kinematicBody2D.CollisionMask = 1;
- _kinematicBody2D.CollisionLayer = 0;
+ KinematicBody.CollisionMask = 1;
+ KinematicBody.CollisionLayer = 0;
//创建碰撞器
- _collisionShape2D = new CollisionShape2D();
- _collisionShape2D.Name = "Collision";
- _rectangleShape2D = new RectangleShape2D();
- _collisionShape2D.Shape = _rectangleShape2D;
- _kinematicBody2D.AddChild(_collisionShape2D);
-
- _kinematicBody2D.ZIndex = 2;
+ CollisionShape = new CollisionShape2D();
+ CollisionShape.Name = "Collision";
+ RectangleShape = new RectangleShape2D();
+ CollisionShape.Shape = RectangleShape;
+ KinematicBody.AddChild(CollisionShape);
}
public override void Update(float delta)
{
if (!IsOver)
{
- _kinematicBody2D.MoveAndSlide(new Vector2(XSpeed, 0).Rotated(Direction * Mathf.Pi / 180));
+ KinematicBody.MoveAndSlide(new Vector2(XSpeed, 0).Rotated(Direction * Mathf.Pi / 180));
Position = new Vector2(0, Position.y - YSpeed * delta);
var rotate = ActivityObject.GlobalRotationDegrees + RotateSpeed * delta;
ActivityObject.GlobalRotationDegrees = rotate;
+ //计算阴影位置
ShadowSprite.GlobalRotationDegrees = rotate;
// ShadowSprite.GlobalRotationDegrees = rotate + (inversionX ? 180 : 0);
- ShadowSprite.GlobalPosition = AnimatedSprite.GlobalPosition + new Vector2(0, 1 - Position.y);
+ ShadowSprite.GlobalPosition = AnimatedSprite.GlobalPosition + new Vector2(0, 2 - Position.y);
var ysp = YSpeed;
YSpeed -= GameConfig.G * delta;
//达到最高点
@@ -107,11 +111,11 @@
public virtual void StartThrow(Vector2 size, Vector2 start, float startHeight, float direction, float xSpeed,
float ySpeed, float rotate)
{
- _collisionShape2D.Disabled = false;
+ CollisionShape.Disabled = false;
IsOver = false;
Size = size;
- _kinematicBody2D.GlobalPosition = StartPosition = start;
+ KinematicBody.GlobalPosition = StartPosition = start;
Direction = direction;
XSpeed = xSpeed;
YSpeed = ySpeed;
@@ -119,31 +123,33 @@
StartYSpeed = ySpeed;
RotateSpeed = rotate;
- _rectangleShape2D.Extents = Size * 0.5f;
-
+ RectangleShape.Extents = Size * 0.5f;
+
var mountParent = ActivityObject.GetParent();
if (mountParent == null)
{
- _kinematicBody2D.AddChild(ActivityObject);
+ KinematicBody.AddChild(ActivityObject);
}
else if (mountParent != ActivityObject)
{
mountParent.RemoveChild(ActivityObject);
- _kinematicBody2D.AddChild(ActivityObject);
+ KinematicBody.AddChild(ActivityObject);
}
Position = new Vector2(0, -startHeight);
- var parent = _kinematicBody2D.GetParent();
+ var parent = KinematicBody.GetParent();
if (parent == null)
{
- RoomManager.Current.SortRoot.AddChild(_kinematicBody2D);
+ RoomManager.Current.SortRoot.AddChild(KinematicBody);
}
else if (parent == RoomManager.Current.ObjectRoot)
{
- parent.RemoveChild(ActivityObject);
- RoomManager.Current.SortRoot.AddChild(_kinematicBody2D);
+ GD.Print("1111");
+ parent.RemoveChild(KinematicBody);
+ RoomManager.Current.SortRoot.AddChild(KinematicBody);
}
+
//显示阴影
ActivityObject.ShowShadowSprite();
ShadowSprite.Scale = AnimatedSprite.Scale;
@@ -159,14 +165,14 @@
var gp = ActivityObject.GlobalPosition;
var gr = ActivityObject.GlobalRotation;
IsOver = true;
- _kinematicBody2D.RemoveChild(ActivityObject);
- var parent = _kinematicBody2D.GetParent();
+ KinematicBody.RemoveChild(ActivityObject);
+ var parent = KinematicBody.GetParent();
parent.AddChild(ActivityObject);
ActivityObject.GlobalPosition = gp;
ActivityObject.GlobalRotation = gr;
}
- _collisionShape2D.Disabled = true;
+ CollisionShape.Disabled = true;
}
///
@@ -182,9 +188,9 @@
///
protected virtual void OnOver()
{
- _kinematicBody2D.GetParent().RemoveChild(_kinematicBody2D);
- RoomManager.Current.ObjectRoot.AddChild(_kinematicBody2D);
- _collisionShape2D.Disabled = true;
+ KinematicBody.GetParent().RemoveChild(KinematicBody);
+ RoomManager.Current.ObjectRoot.AddChild(KinematicBody);
+ CollisionShape.Disabled = true;
}
}
diff --git a/DungeonShooting_Godot/src/game/item/weapon/ThrowGun.cs b/DungeonShooting_Godot/src/game/item/weapon/ThrowGun.cs
deleted file mode 100644
index d3c652a..0000000
--- a/DungeonShooting_Godot/src/game/item/weapon/ThrowGun.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using Godot;
-
-public class ThrowWeapon : ThrowNode
-{
-
- private bool fristOver = true;
-
- public override void _Ready()
- {
- base._Ready();
- ZIndex = 2;
- }
-
- public override void StartThrow(Vector2 size, Vector2 start, float startHeight, float direction, float xSpeed, float ySpeed, float rotate, Node2D mount)
- {
- base.StartThrow(size, start, startHeight, direction, xSpeed, ySpeed, rotate, mount);
- fristOver = true;
- }
-
- protected override void OnOver()
- {
- if (fristOver)
- {
- fristOver = false;
- if (Mount is Weapon gun)
- {
- gun._FallToGround();
- }
- }
- //如果落地高度不够低, 再抛一次
- if (StartYSpeed > 1)
- {
- StartThrow(Size, GlobalPosition, 0, Direction, XSpeed * 0.8f, StartYSpeed * 0.5f, RotateSpeed * 0.5f, null);
- }
- else //结束
- {
- base.OnOver();
- }
- }
- protected override void OnMaxHeight(float height)
- {
- ZIndex = 0;
- }
-}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/item/weapon/ThrowWeapon.cs b/DungeonShooting_Godot/src/game/item/weapon/ThrowWeapon.cs
new file mode 100644
index 0000000..5286173
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/item/weapon/ThrowWeapon.cs
@@ -0,0 +1,41 @@
+
+using Godot;
+
+public class ThrowWeapon : ThrowComponent
+{
+ //是否第一次结束
+ private bool fristOver = true;
+
+ public override void StartThrow(Vector2 size, Vector2 start, float startHeight, float direction, float xSpeed, float ySpeed,
+ float rotate)
+ {
+ KinematicBody.ZIndex = 2;
+ base.StartThrow(size, start, startHeight, direction, xSpeed, ySpeed, rotate);
+ }
+
+ protected override void OnOver()
+ {
+ if (fristOver)
+ {
+ fristOver = false;
+ if (ActivityObject is Weapon gun)
+ {
+ gun._FallToGround();
+ }
+ }
+ //如果落地高度不够低, 再抛一次
+ if (StartYSpeed > 1)
+ {
+ base.StartThrow(Size, GlobalPosition, 0, Direction, XSpeed * 0.8f, StartYSpeed * 0.5f, RotateSpeed * 0.5f);
+ fristOver = true;
+ }
+ else //结束
+ {
+ base.OnOver();
+ }
+ }
+ protected override void OnMaxHeight(float height)
+ {
+ KinematicBody.ZIndex = 0;
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs
index 9b72e36..a9bd5bb 100644
--- a/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs
+++ b/DungeonShooting_Godot/src/game/item/weapon/Weapon.cs
@@ -22,10 +22,10 @@
///
public WeaponAttribute Attribute { get; private set; }
- ///
- /// 武器的图片
- ///
- public Sprite WeaponSprite { get; private set; }
+ // ///
+ // /// 武器的图片
+ // ///
+ //public Sprite WeaponSprite { get; private set; }
///
/// 动画播放器
@@ -131,7 +131,7 @@
Id = id;
Attribute = attribute;
- WeaponSprite = GetNode("WeaponBody/WeaponSprite");
+ //WeaponSprite = GetNode("WeaponBody/WeaponSprite");
FirePoint = GetNode("WeaponBody/FirePoint");
OriginPoint = GetNode("WeaponBody/OriginPoint");
ShellPoint = GetNode("WeaponBody/ShellPoint");
@@ -139,8 +139,10 @@
CollisionShape2D = GetNode("WeaponBody/Collision");
//更新图片
- WeaponSprite.Texture = ResourceLoader.Load(Attribute.Sprite);
- WeaponSprite.Position = Attribute.CenterPosition;
+ var texture = ResourceLoader.Load(Attribute.Sprite);
+ SetDefaultTexture(texture);
+ AnimatedSprite.Position = Attribute.CenterPosition;
+
//开火位置
FirePoint.Position = new Vector2(Attribute.FirePosition.x, -Attribute.FirePosition.y);
OriginPoint.Position = new Vector2(0, -Attribute.FirePosition.y);
@@ -657,9 +659,9 @@
//播放互动效果
if (flag)
{
- this.StartThrow(new Vector2(20, 20), GlobalPosition, 0, 0,
- MathUtils.RandRangeInt(-20, 20), MathUtils.RandRangeInt(20, 50),
- MathUtils.RandRangeInt(-180, 180), WeaponSprite);
+ // this.StartThrow(new Vector2(20, 20), GlobalPosition, 0, 0,
+ // MathUtils.RandRangeInt(-20, 20), MathUtils.RandRangeInt(20, 50),
+ // MathUtils.RandRangeInt(-180, 180), WeaponSprite);
}
}
else //没有武器
@@ -699,12 +701,12 @@
{
Master = master;
//握把位置
- WeaponSprite.Position = Attribute.HoldPosition;
- //清除泛白效果
- ShaderMaterial sm = WeaponSprite.Material as ShaderMaterial;
- sm.SetShaderParam("schedule", 0);
+ AnimatedSprite.Position = Attribute.HoldPosition;
//停止动画
AnimationPlayer.Stop();
+ //清除泛白效果
+ ShaderMaterial sm = (ShaderMaterial) AnimatedSprite.Material;
+ sm.SetShaderParam("schedule", 0);
ZIndex = 0;
//禁用碰撞
CollisionShape2D.Disabled = true;
@@ -717,7 +719,7 @@
public void _ThrowOutWeapon()
{
Master = null;
- WeaponSprite.Position = Attribute.CenterPosition;
+ AnimatedSprite.Position = Attribute.CenterPosition;
AnimationPlayer.Play("Floodlight");
OnThrowOut();
}
diff --git a/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs b/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs
index 31fbc29..e2d9f6f 100644
--- a/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs
+++ b/DungeonShooting_Godot/src/game/item/weapon/gun/Gun.cs
@@ -100,14 +100,14 @@
protected override void OnFire()
{
//创建一个弹壳
- var startPos = GlobalPosition + new Vector2(0, 5);
- var startHeight = 6;
- var direction = GlobalRotationDegrees + MathUtils.RandRangeInt(-30, 30) + 180;
- var xf = MathUtils.RandRangeInt(20, 60);
- var yf = MathUtils.RandRangeInt(60, 120);
- var rotate = MathUtils.RandRangeInt(-720, 720);
- var sprite = ShellPack.Instance();
- sprite.StartThrow(new Vector2(5, 10), startPos, startHeight, direction, xf, yf, rotate, sprite);
+ // var startPos = GlobalPosition + new Vector2(0, 5);
+ // var startHeight = 6;
+ // var direction = GlobalRotationDegrees + MathUtils.RandRangeInt(-30, 30) + 180;
+ // var xf = MathUtils.RandRangeInt(20, 60);
+ // var yf = MathUtils.RandRangeInt(60, 120);
+ // var rotate = MathUtils.RandRangeInt(-720, 720);
+ // var sprite = ShellPack.Instance();
+ // sprite.StartThrow(new Vector2(5, 10), startPos, startHeight, direction, xf, yf, rotate, sprite);
//创建抖动
MainCamera.Main.ProssesDirectionalShake(Vector2.Right.Rotated(GlobalRotation) * 1.5f);
}
diff --git a/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs b/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs
index 66cff82..042b0e2 100644
--- a/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs
+++ b/DungeonShooting_Godot/src/game/item/weapon/gun/Shotgun.cs
@@ -62,14 +62,14 @@
protected override void OnFire()
{
//创建一个弹壳
- var startPos = GlobalPosition + new Vector2(0, 5);
- var startHeight = 6;
- var direction = GlobalRotationDegrees + MathUtils.RandRangeInt(-30, 30) + 180;
- var xf = MathUtils.RandRangeInt(20, 60);
- var yf = MathUtils.RandRangeInt(60, 120);
- var rotate = MathUtils.RandRangeInt(-720, 720);
- var sprite = ShellPack.Instance();
- sprite.StartThrow(new Vector2(5, 10), startPos, startHeight, direction, xf, yf, rotate, sprite);
+ // var startPos = GlobalPosition + new Vector2(0, 5);
+ // var startHeight = 6;
+ // var direction = GlobalRotationDegrees + MathUtils.RandRangeInt(-30, 30) + 180;
+ // var xf = MathUtils.RandRangeInt(20, 60);
+ // var yf = MathUtils.RandRangeInt(60, 120);
+ // var rotate = MathUtils.RandRangeInt(-720, 720);
+ // var sprite = ShellPack.Instance();
+ // sprite.StartThrow(new Vector2(5, 10), startPos, startHeight, direction, xf, yf, rotate, sprite);
//创建抖动
MainCamera.Main.ProssesDirectionalShake(Vector2.Right.Rotated(GlobalRotation) * 1.5f);
}
diff --git a/DungeonShooting_Godot/src/game/role/Player.cs b/DungeonShooting_Godot/src/game/role/Player.cs
index 5894638..5215b85 100644
--- a/DungeonShooting_Godot/src/game/role/Player.cs
+++ b/DungeonShooting_Godot/src/game/role/Player.cs
@@ -189,7 +189,7 @@
var gun = Holster.ActiveWeapon;
if (gun != null)
{
- RoomUI.Current.SetGunTexture(gun.WeaponSprite.Texture);
+ RoomUI.Current.SetGunTexture(gun.GetDefaultTexture());
}
else
{
diff --git a/DungeonShooting_Godot/src/game/role/Role.cs b/DungeonShooting_Godot/src/game/role/Role.cs
index b0bdf54..6075c97 100644
--- a/DungeonShooting_Godot/src/game/role/Role.cs
+++ b/DungeonShooting_Godot/src/game/role/Role.cs
@@ -9,7 +9,7 @@
///
/// 重写的纹理
///
- public Texture Texture { get; protected set; }
+ public Texture OverrideTexture { get; protected set; }
///
/// 移动速度
@@ -132,12 +132,12 @@
StartScele = Scale;
MountPoint = GetNode("MountPoint");
BackMountPoint = GetNode("BackMountPoint");
- if (Texture != null)
+ if (OverrideTexture != null)
{
// 更改纹理
- ChangeFrameTexture(AnimatorNames.Idle, AnimatedSprite, Texture);
- ChangeFrameTexture(AnimatorNames.Run, AnimatedSprite, Texture);
- ChangeFrameTexture(AnimatorNames.ReverseRun, AnimatedSprite, Texture);
+ ChangeFrameTexture(AnimatorNames.Idle, AnimatedSprite, OverrideTexture);
+ ChangeFrameTexture(AnimatorNames.Run, AnimatedSprite, OverrideTexture);
+ ChangeFrameTexture(AnimatorNames.ReverseRun, AnimatedSprite, OverrideTexture);
}
Holster = new Holster(this);
@@ -312,7 +312,7 @@
for (int i = 0; i < count; i++)
{
AtlasTexture temp = spriteFrames.GetFrame(anim, i) as AtlasTexture;
- temp.Atlas = Texture;
+ temp.Atlas = OverrideTexture;
}
}
}
diff --git a/DungeonShooting_Godot/src/game/room/RoomManager.cs b/DungeonShooting_Godot/src/game/room/RoomManager.cs
index 3940b6d..0105d8f 100644
--- a/DungeonShooting_Godot/src/game/room/RoomManager.cs
+++ b/DungeonShooting_Godot/src/game/room/RoomManager.cs
@@ -51,13 +51,13 @@
SoundManager.PlayeMusic("intro.ogg", this, -17f);
var gun1 = WeaponManager.GetGun("1001");
gun1.Position = new Vector2(80, 80);
- gun1.PutDown(gun1.WeaponSprite);
+ gun1.PutDown();
var gun2 = WeaponManager.GetGun("1002");
gun2.Position = new Vector2(80, 120);
- gun2.PutDown(gun2.WeaponSprite);
+ gun2.PutDown();
var gun3 = WeaponManager.GetGun("1003");
gun3.Position = new Vector2(120, 80);
- gun3.PutDown(gun3.WeaponSprite);
+ gun3.PutDown();
// var gun4 = WeaponManager.GetGun4();
// gun4.Position = new Vector2(120, 120);
// gun4.PutDown(gun4.WeaponSprite);