Example #1
0
    private void OnGUI()
    {
        GUI.Label(new Rect(5, 14, 100, 100), "Score: " + Score);

        if (gameState == GameState.InGame)
        {
            return;
        }

        if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 60, 200, 50), "Режим #1"))
        {
            GameStrategy = FindObjectOfType <GameMode1>();
            GameStrategy.SetParams();

            FindObjectOfType <Spawner>().SpawnNext();

            gameState = GameState.InGame;
        }
        else if (GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 + 10, 200, 50), "Режим #2"))
        {
            GameStrategy = FindObjectOfType <GameMode2>();
            GameStrategy.SetParams();

            FindObjectOfType <Spawner>().SpawnNext();

            gameState = GameState.InGame;
        }
    }
Example #2
0
        private Card SetStrategy(PlayerState p, List<Card> hand)
        {
            Card bestCard = null;
            int currentAge = ResourceManager.GetInstance().getGameState().getAge();

            if (p.getPlayedCards().Count() == 0)
                bestCard = BuildWonder(p, hand);

            if (bestCard == null)
                if (noOfPlayers == 3 || noOfPlayers == 7)
                    if (p.getBoard().getCurrentWonderLevel() != currentAge)
                        bestCard = BuildWonder(p, hand);

            if (bestCard == null)
                SetMilitaryStrategy(p, hand);

            if (bestCard == null)
                bestCard = SetScienceStrategy(p, hand);

            if (bestCard == null)
                bestCard = SetCommerceStrategy(p, hand);

            if (bestCard == null)
                bestCard = SetCivilianStrategy(p, hand);

            if (bestCard == null)
            {
                strategy = new RandomStrategy();
                bestCard = strategy.getNextCard(p, hand);
            }

            return bestCard;
        }
Example #3
0
    public IEnumerator loadMap()
    {
        root _data = DataSave.GetData();

        numMap       = _data._Level;
        gameStrategy = _data._strategy;

        Debug.Log(_data.height + " - " + _data.width + " list " + _data.data.Count);
        field = new Field(_data.height, _data.width);
        field.initField(true);
        Debug.Log(_data.data.Count);
        for (int i = 0; i < _data.data.Count; i++)
        {
            var coords = field.findCoordsById(_data.data[i]._id);
            field.array[coords.i, coords.j].setId(_data.data[i]._id);
            field.array[coords.i, coords.j].setRandomNum(_data.data[i]._randomNum);
            field.array[coords.i, coords.j].setState(_data.data[i]._state);
        }

        placeCells();

        yield return(new WaitForEndOfFrame());

        cellState = _data._scellState;

        //grid.enabled = false;
        // SortHierarchy();
    }
Example #4
0
    public void Initialize(int[,] matrix, GameManager gameManager, GameStrategy gameStrategy)
    {
        this.gameManager = gameManager;
        this.matrix      = matrix;
        row = this.matrix.GetLength(0);
        col = this.matrix.GetLength(1);
        this.gameStrategy = gameStrategy;
        LevelText.text    = "Lv." + gameManager.level;
        ScoreText.text    = "Score: " + gameManager.score;
        rowNum            = matrix.GetLength(0);
        colNum            = matrix.GetLength(1);
        float cameraHeight = 2f * Camera.main.orthographicSize;
        float cameraWidth  = cameraHeight * Camera.main.aspect;

        cellWidth  = (cameraWidth * 8 / 9) / (col);
        cellHeight = (cameraHeight * 8 / 9) / row;

        minXPos  = -colNum * (cellWidth - 0.1f) / 2;
        minYPos  = -rowNum * (cellHeight - 0.1f) / 2;
        cellsPos = CalCellPos(rowNum, colNum, minXPos, minYPos, cellWidth, cellHeight);

        Sprite firstTargetSprite  = firstTarget.GetComponent <SpriteRenderer> ().sprite;
        Sprite secondTargetSprite = secondTarget.GetComponent <SpriteRenderer> ().sprite;

        firstTarget.transform.localScale  = new Vector3(Mathf.Abs(cellWidth * 1.0f / firstTargetSprite.bounds.size.x), Mathf.Abs(-cellHeight * 1.0f / firstTargetSprite.bounds.size.y), 1);
        secondTarget.transform.localScale = new Vector3(Mathf.Abs(cellWidth * 1.0f / secondTargetSprite.bounds.size.x), Mathf.Abs(-cellHeight * 1.0f / secondTargetSprite.bounds.size.y), 1);

        CreateCardBoard();
        //RequestInterstitial ();
    }
Example #5
0
        public void init()
        {
            game = GameManager.INSTANCE.newGame();
            GameStrategy gs = game.initGame(MapSize.DEMO);

            gs.addPlayer("User1", UnitType.CYCLOP);
            gs.addPlayer("User2", UnitType.CERBERUS);
            gs.buildGame();
        }
Example #6
0
        public void init()
        {
            gm = GameManager.INSTANCE;
            GameManager.INSTANCE.newGame();
            GameStrategy gs = gm.CurrentGame.initGame(MapSize.DEMO);

            gs.addPlayer("User1", UnitType.CENTAUR);
            gs.addPlayer("User2", UnitType.CERBERUS);
            gs.buildGame();
        }
Example #7
0
 private Card SetScienceStrategy(PlayerState p, List<Card> hand)
 {
     if (noOfPlayers == 5 || noOfPlayers == 7)
         if (hand.Count() > 3)
         {
             strategy = new ScienceStrategy();
             return strategy.getNextCard(p, hand);
         }
     return null;
 }
Example #8
0
    public static void DeleteRow(int y)
    {
        for (int x = 0; x < FieldWidth; ++x)
        {
            Destroy(Grid[x, y].gameObject);
            Grid[x, y] = null;
        }

        GameStrategy.IncScore();
    }
Example #9
0
 public LevelVO(int Id, bool isNegative, GameStrategy Strategy, string RuleImage, int FirstPlayer, int GoalCost)
 {
     this.Id          = Id;
     this.isNegative  = isNegative;
     this.RuleImage   = RuleImage;
     this.Strategy    = Strategy;
     this.FirstPlayer = FirstPlayer;
     this.GoalCost    = GoalCost;
     this.History     = new ArrayList();
     this.IsPassed    = false;
 }
 private Card SetScienceStrategy(PlayerState p, List <Card> hand)
 {
     if (noOfPlayers == 5 || noOfPlayers == 7)
     {
         if (hand.Count() > 3)
         {
             strategy = new ScienceStrategy();
             return(strategy.getNextCard(p, hand));
         }
     }
     return(null);
 }
        public static GameStrategy WinningStrategy(GameStrategy userStrategy)
        {
            switch (userStrategy)
            {
            case GameStrategy.Rock:     return(GameStrategy.Paper);

            case GameStrategy.Paper:    return(GameStrategy.Scissors);

            case GameStrategy.Scissors: return(GameStrategy.Rock);

            default:                    return(GameStrategy.None);
            }
        }
        private Card SetStrategy(PlayerState p, List <Card> hand)
        {
            Card bestCard   = null;
            int  currentAge = ResourceManager.GetInstance().getGameState().getAge();

            if (p.getPlayedCards().Count() == 0)
            {
                bestCard = BuildWonder(p, hand);
            }

            if (bestCard == null)
            {
                if (noOfPlayers == 3 || noOfPlayers == 7)
                {
                    if (p.getBoard().getCurrentWonderLevel() != currentAge)
                    {
                        bestCard = BuildWonder(p, hand);
                    }
                }
            }

            if (bestCard == null)
            {
                bestCard = SetMilitaryStrategy(p, hand);
            }

            if (bestCard == null)
            {
                bestCard = SetScienceStrategy(p, hand);
            }

            if (bestCard == null)
            {
                bestCard = SetCommerceStrategy(p, hand);
            }

            if (bestCard == null)
            {
                bestCard = SetCivilianStrategy(p, hand);
            }

            if (bestCard == null)
            {
                strategy = new RandomStrategy();
                bestCard = strategy.getNextCard(p, hand);
            }

            return(bestCard);
        }
        private Card SetMilitaryStrategy(PlayerState p, List <Card> hand)
        {
            int         currentAge = ResourceManager.GetInstance().getGameState().getAge();
            PlayerState left       = ResourceManager.GetInstance().getGameState().getLeftPlayer(p);
            PlayerState right      = ResourceManager.GetInstance().getGameState().getRightPlayer(p);

            if ((left.getMilitaryPower() >= p.getMilitaryPower() - currentAge) ||
                (right.getMilitaryPower() >= p.getMilitaryPower() - currentAge))
            {
                strategy = new MilitaryStrategy();
                Card c = strategy.getNextCard(p, hand);
                return(c);
            }
            return(null);
        }
Example #14
0
        static void Main(string[] args)
        {
            IFootBalStrategy s = new GameStrategy();

            while (true)
            {
                var x = Console.ReadLine();

                var response = s.Play(x);
                if (!string.IsNullOrEmpty(response))
                {
                    Console.WriteLine(response);
                }
            }
        }
Example #15
0
 private List <IUnit> GetTargets(IArmy first, IArmy second, ISpecialAction unitSpecial)
 {
     if (unitSpecial is Archer)
     {
         return(GameStrategy.GetTargetsForArcher(first, second, unitSpecial));
     }
     else if (unitSpecial is Infantry)
     {
         return(GameStrategy.GetTargetsForInfantry(first, unitSpecial));
     }
     else
     {
         return(GameStrategy.GetTargetsForHealer(first, unitSpecial));
     }
 }
        private void Button_Click_Start(object sender, RoutedEventArgs e)
        {
            //MapSize size_map = 0;
            // Pseudo par défault
            // String name_p1 = "Player1", name_p2 = "Player2";

            /*
             * if (Demo.IsChecked == true) size_map = MapSize.DEMO;
             * if (Small.IsChecked == true) size_map = MapSize.SMALL;
             * if (Standard.IsChecked == true) size_map = MapSize.STANDARD;*/

            name_p1 = Pseudo_Player1.Text;
            name_p2 = Pseudo_Player2.Text;
            if (size_map == 0)
            {
                MessageBox.Show("Veuillez entrer un type de carte !", "Type de carte manquant"); return;
            }
            if (name_p1 == "" || name_p2 == "")
            {
                MessageBox.Show("Veuillez entrer un pseudo pour chaque joueur !", "Pseudo(s) manquant(s)"); return;
            }
            if (name_p1 == name_p2)
            {
                MessageBox.Show("Veuillez entrer un pseudo différent pour chaque joueur !", "Pseudo(s) identique(s)"); return;
            }
            if (race_p1 == (UnitType)9 || race_p2 == (UnitType)9)
            {
                MessageBox.Show("Veuillez entrer une race pour chaque joueur !", "Race(s) manquante(s)"); return;
            }

            Game         g  = GameManager.INSTANCE.newGame();
            GameStrategy gs = g.initGame(size_map);

            // Choisit aléatoirement le joueur commencant la partie
            int begin = new Random().Next(3);

            if (begin == 0)
            {
                gs.addPlayer(name_p1, race_p1); gs.addPlayer(name_p2, race_p2);
            }
            else
            {
                gs.addPlayer(name_p2, race_p2); gs.addPlayer(name_p1, race_p1);
            }

            gs.buildGame();
            NavigationService.Navigate(new GamePage(false));
        }
Example #17
0
 public void NextLevel()
 {
     if (gameStrategy < GameStrategy.Right)
     {
         gameStrategy++;
     }
     else
     {
         gameStrategy = GameStrategy.Normal;
     }
     numMap++;
     ui.UpdateLevel(numMap);
     GameControllerScr.instance._Timer.UpdateTimeValues();
     AnalyticsEventsController.LogPlayerLevel(numMap);
     StartCoroutine(CreateButtonCells());
 }
Example #18
0
        public void PlayOneAction()
        {
            GameChoice   choice   = this.Get_NextChoice();
            GameStrategy strategy = this.GetStrategy(this.Get_ReadableSnapshot(choice.ControllerID));
            GameEffect   effect   = strategy.ChooseBestAction(choice, this);

            if (!(choice.Options.Contains(effect)))
            {
                Console.WriteLine("GameStrategy " + strategy + " made an invalid choice: " + effect);
                effect = strategy.ChooseBestAction(choice, this);
            }
            if (this.ShouldPrint)
            {
                Console.WriteLine(effect.ToString(this));
            }
            effect.Process(this);
        }
    public static IGameStrategy CreateInstance(GameStrategy strategy)
    {
        IGameStrategy gameStrategy = null;

        switch (strategy)
        {
        case GameStrategy.Normal:
            gameStrategy = new NormalStrategy();
            break;

        case GameStrategy.Bottom:
            gameStrategy = new BottomStrategy();
            break;

        case GameStrategy.Top:
            gameStrategy = new TopStrategy();
            break;

        case GameStrategy.Left:
            gameStrategy = new LeftStrategy();
            break;

        case GameStrategy.Right:
            gameStrategy = new RightStrategy();
            break;

        case GameStrategy.LeftAndRight:
            gameStrategy = new LeftAndRightStrategy();
            break;

        case GameStrategy.TopAndBottom:
            gameStrategy = new TopAndBottomStrategy();
            break;

        case GameStrategy.XCenter:
            gameStrategy = new XCenterStrategy();
            break;

        case GameStrategy.YCenter:
            gameStrategy = new YCenterStrategy();
            break;
        }
        return(gameStrategy);
    }
Example #20
0
        public Card getNextCard(PlayerState p, List<Card> hand)
        {
            strategy = new MilitaryStrategy();

            Card c = strategy.getNextCard(p, hand);
            if (c == null)
            {
                strategy = new ScienceStrategy();
                c = strategy.getNextCard(p,hand);
            }

            if (c == null)
            {
                strategy = new CommerceStrategy();
                c = strategy.getNextCard(p, hand);            
            }

            return c;
        }
Example #21
0
        public Card getNextCard(PlayerState p, List <Card> hand)
        {
            strategy = new CivilianStrategy();

            Card c = strategy.getNextCard(p, hand);

            if (c == null)
            {
                strategy = new CommerceStrategy();
                c        = strategy.getNextCard(p, hand);
            }

            if (c == null)
            {
                strategy = new ScienceStrategy();
                c        = strategy.getNextCard(p, hand);
            }

            return(c);
        }
 private Card BuildWonder(PlayerState p, List <Card> hand)
 {
     if (p.getBoard().notMaxYet())
     {
         for (int i = 0; i < hand.Count(); i++)
         {
             if (hand[i].getType() == 1 || hand[i].getType() == 2)
             {
                 if (ResourceManager.GetInstance().ValidateWonder(p))
                 {
                     strategy = new CommerceStrategy();
                     p.setWonderCards(hand[i]);
                     p.getBoard().incrementWonderLevel(p);
                     return(hand[i]);
                 }
             }
         }
     }
     return(null);
 }
        private Card SetCivilianStrategy(PlayerState p, List <Card> hand)
        {
            for (int i = 0; i < hand.Count(); i++)
            {
                if (noOfPlayers == 3 || noOfPlayers == 7)
                {
                    if (hand[i].getName() == "C22" ||
                        hand[i].getName() == "C23" ||
                        hand[i].getName() == "C63" ||
                        hand[i].getName() == "C64")
                    {
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CivilianStrategy();
                            p.addPlayedCards(hand[i]);
                            return(hand[i]);
                        }
                    }
                }

                if (noOfPlayers == 3 || noOfPlayers == 6)
                {
                    if (hand[i].getName() == "C24" ||
                        hand[i].getName() == "C25" ||
                        hand[i].getName() == "C108" ||
                        hand[i].getName() == "C109")
                    {
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CivilianStrategy();
                            p.addPlayedCards(hand[i]);
                            return(hand[i]);
                        }
                    }
                }
            }

            int vc = 0, index = 0;

            for (int i = 0; i < hand.Count(); i++)
            {
                if (hand[i] is CivilianCard)
                {
                    CivilianCard c = (CivilianCard)hand[i];
                    if (c.getVictoryPoints() > vc)
                    {
                        vc    = c.getVictoryPoints();
                        index = i;
                    }
                }
            }

            if (index != 0)
            {
                if (ResourceManager.GetInstance().ValidateCard(p, hand[index]))
                {
                    strategy = new CivilianStrategy();
                    p.addPlayedCards(hand[index]);
                    return(hand[index]);
                }
            }

            return(null);
        }
Example #24
0
 private Card BuildWonder(PlayerState p, List<Card> hand)
 {
     if (p.getBoard().notMaxYet())
     {
         for (int i = 0; i < hand.Count(); i++)
         {
             if (hand[i].getType() == 1 || hand[i].getType() == 2)
             {
                 if (ResourceManager.GetInstance().ValidateWonder(p))
                 {
                     strategy = new CommerceStrategy();
                     p.setWonderCards(hand[i]);
                     p.getBoard().incrementWonderLevel(p);
                     return hand[i];
                 }
             }
         }
     }
     return null;
 }
Example #25
0
        private Card SetCommerceStrategy(PlayerState p, List<Card> hand)
        {
            for (int i = 0; i < hand.Count(); i++)
            {
                if (hand[i].getName() == "C0123"
                ||  hand[i].getName() == "C0124")
                    if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                    {
                        strategy = new CommerceStrategy();
                        p.addPlayedCards(hand[i]);
                        return hand[i];
                    }

                if (noOfPlayers == 3)
                {
                    if (hand[i].getName() == "C031"
                    || hand[i].getName() == "CO33"
                    || hand[i].getName() == "CO71"
                    || hand[i].getName() == "CO74"
                    || hand[i].getName() == "CO77"
                    || hand[i].getName() == "CO121"
                    || hand[i].getName() == "CO125")
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return hand[i];
                        }
                }

                if (noOfPlayers == 4)
                {
                    if (hand[i].getName() == "C028"
                    || hand[i].getName() == "CO79"
                    || hand[i].getName() == "C0120")
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return hand[i];
                        }
                }

                if (noOfPlayers == 5)
                {
                    if (hand[i].getName() == "C029"
                     || hand[i].getName() == "CO75"
                     || hand[i].getName() == "C0126")
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return hand[i];
                        }
                }

                if (noOfPlayers == 6)
                {
                    if (hand[i].getName() == "C036"
                     || hand[i].getName() == "CO72"
                     || hand[i].getName() == "C076"
                     || hand[i].getName() == "CO78"
                     || hand[i].getName() == "C0122"
                     || hand[i].getName() == "C0124")
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return hand[i];
                        }
                }

                if (noOfPlayers == 7)
                {
                    if (hand[i].getName() == "C030"
                    || hand[i].getName() == "C032"
                    || hand[i].getName() == "C034"
                    || hand[i].getName() == "C032"
                    || hand[i].getName() == "C073"
                    || hand[i].getName() == "C080"
                    || hand[i].getName() == "C0127")
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return hand[i];
                        }
                }

                if (TradeCard(p, hand[i]))
                    return hand[i];

            }
            return null;
        }
Example #26
0
 public void setStrategy(int strategy)
 {           
     this.gameStrategy = StrategyFactory.getInstance().getGameStrategy(strategy);            
 }
Example #27
0
        private Card SetCivilianStrategy(PlayerState p, List<Card> hand)
        {

            for (int i = 0; i < hand.Count(); i++)
            {
                if (noOfPlayers == 3 || noOfPlayers == 7)
                    if (hand[i].getName() == "C22"
                    ||  hand[i].getName() == "C23"
                    ||  hand[i].getName() == "C63"
                    ||  hand[i].getName() == "C64")
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CivilianStrategy();
                            p.addPlayedCards(hand[i]);
                            return hand[i];
                        }

                if (noOfPlayers == 3 || noOfPlayers == 6)
                    if (hand[i].getName() == "C24"
                    ||  hand[i].getName() == "C25"
                    ||  hand[i].getName() == "C108"
                    ||  hand[i].getName() == "C109")
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CivilianStrategy();
                            p.addPlayedCards(hand[i]);
                            return hand[i];
                        }
            }

            int vc = 0, index = 0;
            for (int i = 0; i < hand.Count(); i++)
            {
                if (hand[i] is CivilianCard)
                {
                    CivilianCard c = (CivilianCard)hand[i];
                    if (c.getVictoryPoints() > vc)
                    {
                        vc = c.getVictoryPoints();
                        index = i;
                    }
                }
            }

            if (index != 0)
                if (ResourceManager.GetInstance().ValidateCard(p, hand[index]))
                {
                    strategy = new CivilianStrategy();
                    p.addPlayedCards(hand[index]);
                    return hand[index];
                }

            return null;
        }
Example #28
0
 public AggressiveStrategy()
 {
     strategy = new MilitaryStrategy();
 }
Example #29
0
    public IEnumerator Start()
    {
        PareDelegateHandler        += PareDelegateHandlerDebug;
        ButtonHoldDelegateHandler  += ButtonHoldDelegateHandlerDebug;
        ButtonTouchDelegateHandler += ButtonTouchDelegateHandlerDebug;

        gameStrategy        = GameStrategy.Normal;
        countPhotos         = DownloadManager.instance.GetCount();
        numMap              = 1;
        cellStateTMP        = 0;
        cellState           = 0;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        transformUnity      = new TransformUnity();
        mainCamera          = Camera.main;
        LR   = new LineRenderer();
        Line = GameObject.FindGameObjectsWithTag("Line");

        Application.targetFrameRate = 60;


        stats = PlayerStats.instance;
        if (loadGame)
        {
            stats.LoadData();
            StartCoroutine(loadMap());
        }
        else
        {
            stats.LoadData();
            stats.SetPointsTo(0);
        }


        #region GridLoading
        if (loadGame == false)
        {
            yield return(StartCoroutine(CreateButtonCells()));
        }
        else
        {
            if (DataSave.GetData() != null)
            {
                Debug.Log("load map");
                yield return(StartCoroutine(loadMap()));
            }
            else
            {
                yield return(StartCoroutine(CreateButtonCells()));

                _Timer.AddTime();
            }
        }
        #endregion
        Camera.main.transparencySortMode = TransparencySortMode.Orthographic;

        ui.Init();

        if (loadGame)
        {
            _Timer.SetTime(DataSave.GetData().time);
        }
        else
        {
            _Timer.StartTimer();
        }

        //Save();
        if (PlayerPrefs.HasKey("_tut2"))
        {
            ui.GetComponent <Canvas>().renderMode  = RenderMode.ScreenSpaceCamera;
            ui.GetComponent <Canvas>().worldCamera = Camera.main;
        }
    }
Example #30
0
 public GameResult Challenge(GameStrategy opponentChoice)
 {
     return opponentChoice.GetResult(this);
 }
Example #31
0
 public AggressiveStrategy()
 {
     strategy = new MilitaryStrategy();
 }
Example #32
0
        private Card SetMilitaryStrategy(PlayerState p, List<Card> hand)
        {
            int currentAge = ResourceManager.GetInstance().getGameState().getAge();
            PlayerState left = ResourceManager.GetInstance().getGameState().getLeftPlayer(p);
            PlayerState right = ResourceManager.GetInstance().getGameState().getRightPlayer(p);

            if ((left.getMilitaryPower() >= p.getMilitaryPower() - currentAge)
            || (right.getMilitaryPower() >= p.getMilitaryPower() - currentAge))
            {
                strategy = new MilitaryStrategy();
                Card c = strategy.getNextCard(p, hand);
                return c;
            }
            return null;
        }
Example #33
0
 public void setStrategy(GameStrategy strategy)
 {
     this.strategy = strategy;
 }        
Example #34
0
 public GameResult Challenge(GameStrategy opponentChoice)
 {
     return(opponentChoice.GetResult(this));
 }
        private Card SetCommerceStrategy(PlayerState p, List <Card> hand)
        {
            for (int i = 0; i < hand.Count(); i++)
            {
                if (hand[i].getName() == "C0123" ||
                    hand[i].getName() == "C0124")
                {
                    if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                    {
                        strategy = new CommerceStrategy();
                        p.addPlayedCards(hand[i]);
                        return(hand[i]);
                    }
                }

                if (noOfPlayers == 3)
                {
                    if (hand[i].getName() == "C031" ||
                        hand[i].getName() == "CO33" ||
                        hand[i].getName() == "CO71" ||
                        hand[i].getName() == "CO74" ||
                        hand[i].getName() == "CO77" ||
                        hand[i].getName() == "CO121" ||
                        hand[i].getName() == "CO125")
                    {
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return(hand[i]);
                        }
                    }
                }

                if (noOfPlayers == 4)
                {
                    if (hand[i].getName() == "C028" ||
                        hand[i].getName() == "CO79" ||
                        hand[i].getName() == "C0120")
                    {
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return(hand[i]);
                        }
                    }
                }

                if (noOfPlayers == 5)
                {
                    if (hand[i].getName() == "C029" ||
                        hand[i].getName() == "CO75" ||
                        hand[i].getName() == "C0126")
                    {
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return(hand[i]);
                        }
                    }
                }

                if (noOfPlayers == 6)
                {
                    if (hand[i].getName() == "C036" ||
                        hand[i].getName() == "CO72" ||
                        hand[i].getName() == "C076" ||
                        hand[i].getName() == "CO78" ||
                        hand[i].getName() == "C0122" ||
                        hand[i].getName() == "C0124")
                    {
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return(hand[i]);
                        }
                    }
                }

                if (noOfPlayers == 7)
                {
                    if (hand[i].getName() == "C030" ||
                        hand[i].getName() == "C032" ||
                        hand[i].getName() == "C034" ||
                        hand[i].getName() == "C032" ||
                        hand[i].getName() == "C073" ||
                        hand[i].getName() == "C080" ||
                        hand[i].getName() == "C0127")
                    {
                        if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                        {
                            strategy = new CommerceStrategy();
                            p.addPlayedCards(hand[i]);
                            return(hand[i]);
                        }
                    }
                }

                /*if (TradeCard(p, hand[i]))
                 *  return hand[i];*/
            }
            return(null);
        }
Example #36
0
 public void setStrategy(int strategy)
 {
     this.gameStrategy = StrategyFactory.getInstance().getGameStrategy(strategy);
 }
Example #37
0
 public string ArmyInfo()
 {
     return($"{GameStrategy.Info(FirstArmy)}\n\n\n\t\t\t---------VS---------\n\n\n{GameStrategy.Info(SecondArmy)}");
 }
Example #38
0
 public static void DeleteFullRows()
 {
     GameStrategy.DeleteFullRows();
 }
 public GameStartUseCase(GameStrategy gameStrategy)
 {
     this.gameStrategy = gameStrategy;
 }