Example #1
0
    void InitializeGame()
    {
        playerCards = new List <CardInfo>();
        enemyCards  = new List <CardInfo>();
        for (int i = 1; i <= 13; i++)
        {
            playerCards.Add(new CardInfo(i));
            enemyCards.Add(new CardInfo(i));
        }
        int p1, p2, gk, gov;

        GetBonusPos(out p1, out p2, out gk, out gov);
        playerCards[p1].mEffect  = CardInfo.CardEffect.Pioneer;
        playerCards[p2].mEffect  = CardInfo.CardEffect.Pioneer;
        playerCards[gk].mEffect  = CardInfo.CardEffect.GiantKiller;
        playerCards[gov].mEffect = CardInfo.CardEffect.Governor;

        GetBonusPos(out p1, out p2, out gk, out gov);
        enemyCards[p1].mEffect  = CardInfo.CardEffect.Pioneer;
        enemyCards[p2].mEffect  = CardInfo.CardEffect.Pioneer;
        enemyCards[gk].mEffect  = CardInfo.CardEffect.GiantKiller;
        enemyCards[gov].mEffect = CardInfo.CardEffect.Governor;
        for (int i = 0; i < enemyCards.Count; i++)
        {
            var temp        = enemyCards[i];
            int randomIndex = Random.Range(i, enemyCards.Count);
            enemyCards[i]           = enemyCards[randomIndex];
            enemyCards[randomIndex] = temp;
        }
        onGameInitialized?.Invoke();
    }
Example #2
0
        private void Start()
        {
            _player.SetOnDeath(() => OnPlayerDies.Invoke(_player.HasRevived()));

            _player.SetOnRevive(() => {
                _enemies.ForEach(Destroy);
                _enemies.Clear();
            });

            OnGameInitialized.Invoke();
        }