Пример #1
0
        private void OnTriggerEnter2D(Collider2D other)
        {
            if (!other.CompareTag(Constants.PLAYER_TAG))
            {
                return;
            }

            diggable = true;
            digger   = other.GetComponent <DigAction>();
        }
Пример #2
0
        protected virtual List <IAction> GetAllPossibleActions()
        {
            List <IAction> actions = new List <IAction>();
            IAction        action;
            IPlayer        player = Game.ActivePlayer;

            //no time left
            if (player.Time.RemainingWeeks() == 0)
            {
                return(actions);
            }

            // change cards
            foreach (IPlace place in GameSettings.Places)
            {
                if (place is ICardChangePlace)
                {
                    action = new ChangeCardsAction((ICardChangePlace)place);
                    if (player.IsEnoughTime(action))
                    {
                        actions.Add(action);
                    }
                }
            }


            // take card
            foreach (ICard card in Game.DisplayedCards)
            {
                if (card == null)
                {
                    continue;
                }

                action = new TakeCardAction(card);
                if (player.IsEnoughTime(action))
                {
                    actions.Add(action);
                }
            }

            // execute exhibition
            foreach (IExhibitionCard exhibition in Game.DisplayedExhibitions)
            {
                if (exhibition == null)
                {
                    continue;
                }

                action = new ExecuteExhibitionAction(exhibition);
                if (player.IsEnoughTime(action) &&
                    (
                        // (player is DeterministicPlayer && exhibition.CheckRequiredArtifacts(((DeterministicPlayer)player).AssumedArtifacts)) ||
                        exhibition.CheckRequiredArtifacts(player.Tokens)
                    )
                    )
                {
                    actions.Add(action);
                }
            }

            // dig
            foreach (DigSite digSite in Game.DigsiteInventory.Keys)
            {
                if (!player.CanIDig(digSite))
                {
                    continue;
                }

                for (int weeks = 1; weeks <= 12; weeks++)
                {
                    // add all single use card options
                    List <ICard> singleUseCards = player.GetUsableSingleUseCards(digSite);
                    foreach (var subset in GameSettings.Subsets <ICard>(singleUseCards))
                    {
                        action = new DigAction(digSite, weeks, new List <ICard>(subset), null);
                        if (player.IsEnoughTime(action))
                        {
                            actions.Add(action);
                        }
                    }
                }
            }


            // use zeppelin
            if (player.Zeppelins > 0 && !((Player)player).useZeppelin && actions.Count > 0)
            {
                actions.Add(new ZeppelinAction(true));
            }

            // end year
            // TODO upravit
            if (actions.Count < 3)
            {
                actions.Add(new EndYearAction());
            }


            return(actions);
        }