Отображение в редакторе при изменении экспортированных переменных, музыка на все дни, звуки дверей, NPC.
This commit is contained in:
parent
fec3f22665
commit
3c1619ee9f
47 changed files with 657 additions and 89 deletions
|
@ -9,6 +9,7 @@ public partial class Player : CharacterBody2D
|
|||
public enum State
|
||||
{
|
||||
Normal,
|
||||
Wait,
|
||||
Transition,
|
||||
ReadChat
|
||||
}
|
||||
|
@ -20,10 +21,10 @@ public partial class Player : CharacterBody2D
|
|||
get => _state;
|
||||
private set
|
||||
{
|
||||
_state = value;
|
||||
switch (_state)
|
||||
switch (value)
|
||||
{
|
||||
case State.Normal:
|
||||
if (_state == State.Transition) DoorSounds.Play();
|
||||
Visible = true;
|
||||
break;
|
||||
case State.Transition:
|
||||
|
@ -32,9 +33,12 @@ public partial class Player : CharacterBody2D
|
|||
case State.ReadChat:
|
||||
// ChatLog.Visible = !ChatLog.Visible;
|
||||
break;
|
||||
case State.Wait:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
_state = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,7 +74,8 @@ public partial class Player : CharacterBody2D
|
|||
protected PanelContainer ChatLog;
|
||||
protected Camera2D Camera;
|
||||
protected AudioCollection Footsteps;
|
||||
|
||||
protected AudioCollection DoorSounds;
|
||||
|
||||
private Vector2 _newPosition;
|
||||
private double _currentTransitionTime = 0;
|
||||
private double _currentCameraTransitionTime = 0;
|
||||
|
@ -84,6 +89,7 @@ public partial class Player : CharacterBody2D
|
|||
ChatLog = (PanelContainer)FindChild("ChatLog");
|
||||
Camera = (Camera2D)FindChild("Camera2D");
|
||||
Footsteps = (AudioCollection)FindChild("Footsteps");
|
||||
DoorSounds = (AudioCollection)FindChild("DoorSounds");
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
|
@ -172,6 +178,8 @@ public partial class Player : CharacterBody2D
|
|||
}
|
||||
}
|
||||
break;
|
||||
case State.Wait:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
@ -189,9 +197,10 @@ public partial class Player : CharacterBody2D
|
|||
|
||||
if (InteractableObject is Door door)
|
||||
{
|
||||
DoorSounds.Play();
|
||||
_previousPosition = GlobalPosition;
|
||||
_nextPosition = door.Exit.GlobalPosition;
|
||||
CurrentState = State.Transition;
|
||||
CurrentState = State.Wait;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,4 +217,12 @@ public partial class Player : CharacterBody2D
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _on_door_opened()
|
||||
{
|
||||
if (CurrentState == State.Wait)
|
||||
{
|
||||
CurrentState = State.Transition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue