public void Ctor(IReactiveProperty <EnumBattleWindow> battleState) { base.Ctor(); LevelGeneratorPanel.Ctor(); FightPanel.Ctor(); VictoryPanel.Ctor(); PausePanel.Ctor(); FailPanel.Ctor(); _battleState = battleState; _battleState.Subscribe(_ => { if (!enabled) { return; } if (_battleState.Value == EnumBattleWindow.DungeonGenerator) { LevelGeneratorPanel.Show(); } else { LevelGeneratorPanel.Hide(); } if (_battleState.Value == EnumBattleWindow.Fight) { FightPanel.Show(); } else { FightPanel.Hide(); } if (_battleState.Value == EnumBattleWindow.Victory) { VictoryPanel.Show(); } else { VictoryPanel.Hide(); } if (_battleState.Value == EnumBattleWindow.Fail) { FailPanel.Show(); } else { FailPanel.Hide(); } if (_battleState.Value == EnumBattleWindow.Pause) { PausePanel.Show(); } else { PausePanel.Hide(); } }).AddTo(_subscriptions); }
//Reroll dice protected override void UseAbility(FightPanel fight) { _hideDiceOnUse = false; _maxUses--; Dice dice = _diceHolders[0].ContainedDice; dice.RollWithAnim(); }
//Increase dice value by 1 protected override void UseAbility(FightPanel fight) { _hideDiceOnUse = false; _maxUses--; Dice dice = _diceHolders[0].ContainedDice; dice.Value = Mathf.Min(dice.Value + 1, 6); dice.SetRollAnimation(); }
private void Awake() { if (Instance != null) { Destroy(gameObject); return; } Instance = this; }
/* * REQUIRE: use Init() after instantiate! */ public void Init(bool playerOwner) { Fight = FightPanel.Instance; bool flag = CanUse(Fight); if (_isEnemyAbility) { flag = false; } foreach (DiceHolder dh in _diceHolders) { dh.canPlayerPlaceDice = flag; } }
//Destroy 2 random enemy dice protected override void UseAbility(FightPanel fight) { List <Dice> dice = fight.GetEnemyDice(); //Dice#1 int index = Random.Range(0, dice.Count); dice[index].Disable(); dice.RemoveAt(index); if (fight.GetEnemyDice().Count > 1) { //Dice#2 index = Random.Range(0, dice.Count); dice[index].Disable(); dice.RemoveAt(index); } }
protected override bool CanUse(FightPanel fight) { return(_maxUses > 0); }
void Start() { fightPanel = ViewMapper <FightPanel> .instance; }
protected abstract bool CanUse(FightPanel fight);
protected abstract void UseAbility(FightPanel fight);
public static void Create() { var prefab = Resources.Load <FightPanel>("FightPanel"); s_Instance = Instantiate(prefab); }
protected override bool CanUse(FightPanel fight) { return(fight.GetEnemyDice().Count > 1 && fight.GetPlayerDice().Count > 2); }