mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 14:05:53 +00:00
Player owner
This commit is contained in:
parent
2e0ad40f33
commit
3064a0a5a0
3 changed files with 9 additions and 6 deletions
|
|
@ -12,7 +12,7 @@ public abstract partial class ElevatorMovementState : BaseState<ElevatorState, E
|
|||
{
|
||||
|
||||
protected GTween Tween;
|
||||
protected Node2D OldPlayerParent;
|
||||
//protected Node2D OldPlayerParent;
|
||||
|
||||
protected abstract Vector2 StartingPosition { get; }
|
||||
protected abstract Vector2 EndingPosition { get; }
|
||||
|
|
@ -37,15 +37,15 @@ public abstract partial class ElevatorMovementState : BaseState<ElevatorState, E
|
|||
private void RestorePlayerParent()
|
||||
{
|
||||
if (PlayerBody is null) return;
|
||||
PlayerBody.Reparent(OldPlayerParent);
|
||||
OldPlayerParent = null;
|
||||
PlayerBody.Reparent(PlayerBody.Owner);
|
||||
//OldPlayerParent = null;
|
||||
MainObject.CachedPlayer?.StateMachine.SetState(PlayerState.Active);
|
||||
}
|
||||
|
||||
private void CatchPlayer()
|
||||
{
|
||||
if (PlayerBody is null) return;
|
||||
OldPlayerParent = PlayerBody.GetParent<Node2D>();
|
||||
//OldPlayerParent = PlayerBody.GetParent<Node2D>();
|
||||
MainObject.CachedPlayer.StateMachine.SetState(PlayerState.Cutscene);
|
||||
PlayerBody.Reparent(MainObject);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,8 +164,11 @@ public partial class GameManager : Node2D
|
|||
//_player = this.CreateChild<PlayerMovement>(PlayerTemplate, PlayerSpawnMarker.Position );
|
||||
_player = PlayerTemplate.Instantiate<PlayerFSMProxy>();
|
||||
|
||||
this.CallDeferred("add_child", _player);
|
||||
//this.CallDeferred("add_child", _player);
|
||||
this.AddChild(_player);
|
||||
_player.Owner = this;
|
||||
_player.Transform = this.GlobalTransform;
|
||||
|
||||
|
||||
_player.GlobalPosition = GetStartPosition();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue