Esempio n. 1
0
        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);
        }
Esempio n. 2
0
    //Reroll dice
    protected override void UseAbility(FightPanel fight)
    {
        _hideDiceOnUse = false;
        _maxUses--;
        Dice dice = _diceHolders[0].ContainedDice;

        dice.RollWithAnim();
    }
Esempio n. 3
0
    //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();
    }
Esempio n. 4
0
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
         return;
     }
     Instance = this;
 }
Esempio n. 5
0
    /*
     *   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;
        }
    }
Esempio n. 6
0
    //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);
        }
    }
Esempio n. 7
0
 protected override bool CanUse(FightPanel fight)
 {
     return(_maxUses > 0);
 }
Esempio n. 8
0
 void Start()
 {
     fightPanel = ViewMapper <FightPanel> .instance;
 }
Esempio n. 9
0
 protected abstract bool CanUse(FightPanel fight);
Esempio n. 10
0
 protected abstract void UseAbility(FightPanel fight);
Esempio n. 11
0
    public static void Create()
    {
        var prefab = Resources.Load <FightPanel>("FightPanel");

        s_Instance = Instantiate(prefab);
    }
Esempio n. 12
0
 protected override bool CanUse(FightPanel fight)
 {
     return(fight.GetEnemyDice().Count > 1 && fight.GetPlayerDice().Count > 2);
 }