Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2fa8aa9fbc | |||
| 6deb6e29fd | |||
| edc133749f | |||
| 2ed9dbbc52 | |||
| a736adaafb |
@@ -307,6 +307,11 @@ public partial class FightHappening : Node
|
|||||||
HappeningData.enemyFighterFormation.SetFighterAtPosition(emptySlotIndex, fighter);
|
HappeningData.enemyFighterFormation.SetFighterAtPosition(emptySlotIndex, fighter);
|
||||||
HappeningData.fighterTurn.AddAsLast(fighter);
|
HappeningData.fighterTurn.AddAsLast(fighter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GD.RandRange(0, 2) != 0) // 2/3 chance for vesna to start
|
||||||
|
{
|
||||||
|
HappeningData.fighterTurn.SpinBack();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExecuteNextFighter()
|
private void ExecuteNextFighter()
|
||||||
|
|||||||
@@ -99,6 +99,23 @@ public class FighterTurn : IEnumerable<FightWorld.Fighter>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the current one back
|
||||||
|
/// This is an expensive operation, because the entire data structure needs to be circled
|
||||||
|
/// </summary>
|
||||||
|
public void SpinBack()
|
||||||
|
{
|
||||||
|
if (_currentNode == null) return;
|
||||||
|
|
||||||
|
var node = _currentNode;
|
||||||
|
while (node.next != _currentNode)
|
||||||
|
{
|
||||||
|
node = node.next;
|
||||||
|
}
|
||||||
|
|
||||||
|
_currentNode = node;
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerator<FightWorld.Fighter> GetEnumerator()
|
public IEnumerator<FightWorld.Fighter> GetEnumerator()
|
||||||
{
|
{
|
||||||
if (_currentNode == null) return Enumerable.Empty<FightWorld.Fighter>().GetEnumerator();
|
if (_currentNode == null) return Enumerable.Empty<FightWorld.Fighter>().GetEnumerator();
|
||||||
|
|||||||
@@ -9,9 +9,15 @@ public partial class SwitchSceneOnFightEnd : Node
|
|||||||
|
|
||||||
public void OnFightStateEnter(FightHappening.FightState to)
|
public void OnFightStateEnter(FightHappening.FightState to)
|
||||||
{
|
{
|
||||||
if (to is FightHappening.FightState.PlayerWin
|
if (to is FightHappening.FightState.PlayerWin )
|
||||||
or FightHappening.FightState.EnemyWin)
|
|
||||||
_ = SwitchSceneAfterTime(2.0f);
|
_ = SwitchSceneAfterTime(2.0f);
|
||||||
|
|
||||||
|
if (to is FightHappening.FightState.EnemyWin)
|
||||||
|
{
|
||||||
|
_fightSceneSwitcher.ExitFight();
|
||||||
|
_fightSceneSwitcher.ExitFightWorld();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SwitchSceneAfterTime(float seconds)
|
private async Task SwitchSceneAfterTime(float seconds)
|
||||||
|
|||||||
Reference in New Issue
Block a user