Skip to content

Commit 1f69fef

Browse files
committed
Firming up gameflow
Winning battle-> relic selection continue Lose -> Reset and return to title screen Changed clone functions, to fix crash on GC.
1 parent 1cdd479 commit 1f69fef

4 files changed

Lines changed: 11 additions & 2 deletions

File tree

Classes/Notes/Note.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public Note Clone()
4949
{
5050
//Eventually could look into something more robust, but for now shallow copy is preferable.
5151
//We only would want val and name to be copied by value
52-
return (Note)MemberwiseClone();
52+
Note newNote = new Note(Name, Tooltip, Texture, Owner, _baseVal, NoteEffect);
53+
return newNote;
5354
}
5455
}

Classes/Relics/RelicTemplate.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public RelicTemplate(
2525

2626
public RelicTemplate Clone()
2727
{
28-
return (RelicTemplate)MemberwiseClone();
28+
RelicTemplate newRelic = new RelicTemplate(Name, Tooltip, Texture, Effects);
29+
return newRelic;
2930
}
3031
}

Globals/StageProducer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ public void TransitionStage(Stages nextStage)
154154
switch (nextStage)
155155
{
156156
case Stages.Title:
157+
_isInitialized = false;
157158
GetTree().ChangeSceneToFile("res://scenes/SceneTransitions/TitleScreen.tscn");
158159
break;
159160
case Stages.Battle:

scenes/BattleDirector/scripts/BattleDirector.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public partial class BattleDirector : Node2D
3232

3333
private SongData _curSong;
3434

35+
private bool _battleEnd;
36+
3537
#endregion
3638

3739
#region Note Handling
@@ -122,6 +124,8 @@ public override void _Process(double delta)
122124
{
123125
TimeKeeper.CurrentTime = Audio.GetPlaybackPosition();
124126
CD.CheckMiss();
127+
if (_battleEnd)
128+
GetNode<StageProducer>("/root/StageProducer").TransitionStage(Stages.Map);
125129
}
126130
#endregion
127131

@@ -210,6 +214,7 @@ private void CheckBattleStatus(PuppetTemplate puppet)
210214
if (puppet == Player)
211215
{
212216
GD.Print("Player is Dead");
217+
GetNode<StageProducer>("/root/StageProducer").TransitionStage(Stages.Title);
213218
return;
214219
}
215220

@@ -218,6 +223,7 @@ private void CheckBattleStatus(PuppetTemplate puppet)
218223
{
219224
GD.Print("Enemy is dead");
220225
ShowRewardSelection(3);
226+
_battleEnd = true;
221227
}
222228
}
223229

0 commit comments

Comments
 (0)