diff --git a/DungeonShooting_Godot/src/framework/activity/Component.cs b/DungeonShooting_Godot/src/framework/activity/Component.cs index af31e06..30a1fd9 100644 --- a/DungeonShooting_Godot/src/framework/activity/Component.cs +++ b/DungeonShooting_Godot/src/framework/activity/Component.cs @@ -126,6 +126,10 @@ /// 挂载物体的碰撞器节点 /// public CollisionShape2D Collision => Master.Collision; + /// + /// 移动控制器 + /// + public MoveController MoveController => Master.MoveController; /// /// 是否启用当前组件, 如果禁用, 则不会调用 Process 和 PhysicsProcess @@ -290,6 +294,11 @@ { return Master.GetParent(); } + + public void Reparent(Node node) + { + Master.Reparent(node); + } public long StartCoroutine(IEnumerator able) { diff --git a/DungeonShooting_Godot/src/game/activity/role/SubLine.cs b/DungeonShooting_Godot/src/game/activity/role/SubLine.cs index 87bed10..a5beaf8 100644 --- a/DungeonShooting_Godot/src/game/activity/role/SubLine.cs +++ b/DungeonShooting_Godot/src/game/activity/role/SubLine.cs @@ -89,22 +89,15 @@ length = _range; } + var r = master.ConvertRotation(master.MountPoint.RealRotation); //更新 Ray 的位置角度 - _rayCast2D.GlobalPosition = weapon.FirePoint.GlobalPosition; + _rayCast2D.GlobalPosition = firePointGlobalPosition; _rayCast2D.TargetPosition = new Vector2(_range, 0); - _rayCast2D.Rotation = master.ConvertRotation(master.MountPoint.RealRotation); + _rayCast2D.Rotation = r; //计算 line2D 的点 var position = _line2D.ToLocal(firePointGlobalPosition); - Vector2 position2; - if (master.Face == FaceDirection.Right) - { - position2 = Vector2.FromAngle(master.MountPoint.RealRotation) * length; - } - else - { - position2 = Vector2.FromAngle(Mathf.Pi - master.MountPoint.RealRotation) * length; - } + Vector2 position2 = Vector2.FromAngle(r) * length; _line2D.Points = new Vector2[] {