Fix flow to/from battle, add cheat code to win
This commit is contained in:
parent
0b295af56b
commit
959458ad74
7 changed files with 58 additions and 16 deletions
|
|
@ -43,7 +43,7 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
BattleParameters parameters = BattleSetup.RetrieveParameters();
|
||||
if (parameters == null) {
|
||||
Debug.Log("Using default battle");
|
||||
parameters = DebugBattle.CreateParameters();
|
||||
parameters = CheatBattle.CreateParameters();
|
||||
}
|
||||
|
||||
this.heroCardDatabase = new HeroCardDatabase();
|
||||
|
|
@ -150,6 +150,10 @@ public class BattleController : MonoBehaviour, IBattleEffectApplier, IBattleEffe
|
|||
void Start()
|
||||
{
|
||||
StartCoroutine(RunBattleRounds());
|
||||
|
||||
new GameObject("CheatBattle").AddComponent<CheatBattle>().OnWinCode += delegate {
|
||||
BattleResult.FinishBattle(new BattleResult(true));
|
||||
};
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DebugBattle
|
||||
public class CheatBattle: MonoBehaviour
|
||||
{
|
||||
public static BattleParameters CreateParameters() {
|
||||
HeroId[] heroIds = new HeroId[3] {
|
||||
|
|
@ -66,4 +66,22 @@ public class DebugBattle
|
|||
parameters.SetMonsters(monsterIds, mCardIds, mCardOwnerIndexes);
|
||||
return parameters;
|
||||
}
|
||||
|
||||
|
||||
public delegate void CheatAction();
|
||||
public event CheatAction OnWinCode;
|
||||
|
||||
private string lastCommands = "";
|
||||
|
||||
void Update() {
|
||||
this.lastCommands += Input.inputString;
|
||||
|
||||
if (this.lastCommands.Length > 10) {
|
||||
this.lastCommands = this.lastCommands.Substring(this.lastCommands.Length - 10);
|
||||
}
|
||||
|
||||
if (this.lastCommands.EndsWith("win")) {
|
||||
this.OnWinCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue