示例#1
0
 // Start is called before the first frame update
 void Start()
 {
     er          = GetComponent <EnemyResources>();
     rb          = GetComponent <Rigidbody2D>();
     player      = GameObject.FindGameObjectWithTag("Player");
     attackReady = false;
     pr          = player.GetComponent <PlayerResources>();
     anim        = GetComponent <Animator>();
     ps          = GetComponentInChildren <ParticleSystem>();
 }
示例#2
0
文件: GameManager.cs 项目: W3SS/Carty
        /// <summary>
        /// Starts a match. Creates all necessary game objects and cards.
        /// </summary>
        /// <param name="matchInfo">Information about initial state of the match. See MatchInfo.</param>
        public void StartMatch(MatchInfo matchInfo)
        {
            MatchInfo = matchInfo;

            CreateBoardObjects();
            PlayerDeck.FillWithCards(matchInfo.PlayerDeckCards);
            EnemyDeck.FillWithCards(matchInfo.EnemyDeckCards);
            PlayerHand.FillWithCards(matchInfo.PlayerStartingHandCards);
            EnemyHand.FillWithCards(matchInfo.EnemyStartingHandCards);

            PlayerHero.MaxHealth = PlayerHero.CurrentHealth = matchInfo.PlayerHealth;
            EnemyHero.MaxHealth  = EnemyHero.CurrentHealth = matchInfo.EnemyHealth;

            PlayerResources.Init(matchInfo.PlayerStartingResource);
            EnemyResources.Init(matchInfo.EnemyStartingResource);


            if (matchInfo.PlayerAmountOfCardDrawBeforeGame > 0)
            {
                PlayerHand.ImmidiatelyTakeCardsFromDeck(PlayerDeck, matchInfo.PlayerAmountOfCardDrawBeforeGame);
            }

            if (matchInfo.EnemyAmountOfCardDrawBeforeGame > 0)
            {
                EnemyHand.ImmidiatelyTakeCardsFromDeck(EnemyDeck, matchInfo.EnemyAmountOfCardDrawBeforeGame);
            }

            if (matchInfo.PlayerGoesFirst)
            {
                StartPlayerTurn();
            }
            else
            {
                StartEnemyTurn();
            }
        }