Example #1
0
 public override void Read()
 {
     if (node != null)
     {
         CGME_game = new CGME.Game();
         CGME_game.Read(node.data);
     }
 }
Example #2
0
        public static CGME.Game Build()
        {
            // BUILDING THE GAME TABLE
            game = new CGME.Game();

            // BUILDING PHASES
            AddPhase (new Phase("Play Phase"));

            // BUILDING ACTIONS

            Action pass =  new ActionEndPhase("End Phase");
            ActionConditionWaitForInput play_wait = new ActionConditionWaitForInput("Pass",pass);

            game.GetPhase("Play Phase").AddAction (play_wait);

            // BUILDING PLAYERS
            AddPlayer (new Player("Game Player"));

            AddPlayer (new Player("Human Player"));

            // BUILDING DECKS
            game.GetPlayer("Human Player").AddDeck(new Deck("Draw Pile"));

            // ADDING RESOURCES
            game.AddResource(new ResourceNumber("Life Points",30), "Human Player");
            game.AddResource(new ResourceNumber("Life Points",30), "Game Player");
            game.AddResource (new ResourceNumber("Victory Points", 0), "Human Player");

            // BUILDING CARDS
            card_list.Add(new Card("Dwarf Dork",false));

            // BUILD DECKS
            for (int i = 1; i <= 2; i++){
                Card new_card = card_list[0];
                new_card.AddResource(new ResourceText("Description", "Drunk and Smelly"));
                new_card.AddResource(new ResourceAction("Play Phase",new ActionAttack("Attack")));

                game.GetPlayer ("Human Player").GetDeck ("Draw Pile").AddCard(new_card);
            }

            return game;
        }
Example #3
0
        public static CGME.Game Build()
        {
            // BUILDING THE GAME TABLE
            game = new CGME.Game();

            // BUILDING PLAYERS
            //CGME.Player game_player = Factory.BuildPlayer("Game Player", true);
            game.AddPlayer (new Player("Game Player"));

            //CGME.Player human_player = Factory.BuildPlayer("Human Player", true);
            game.AddPlayer (new Player("Human Player"));

                // ADDING RESOURCES
                game.AddResource(new Resource<int>("Life Points",30), "Human Player");
                game.AddResource(new Resource<int>("Life Points",30), "Game Player");

                game.AddResource (new Resource<int>("Victory Points", 0), "Human Player");

                // BUILDING DECKS
                game.GetPlayer("Human Player").AddDeck(new Deck("Draw Pile"));

                    // BUILDING CARDS
                    for (int i = 1; i <= 2; i++){
                        game.GetPlayer ("Human Player").GetDeck ("Draw Pile").AddCard(new Card("Dwarf Dork"));
                        game.AddResource(new Resource<string>("Description", "Drunk and Smelly"),"Dwarf Dork");
                    }

            // BUILDING RULESET
            game.AddRuleset(new Ruleset("Standard"));

                // BUILDING PHASES
                game.GetRuleset ("Standard").AddPhase (new Phase("Draw Phase"));
                game.GetRuleset ("Standard").AddPhase (new Phase("Play Phase"));

                    // BUILDING ACTIONS
                    game.GetRuleset ("Standard").GetPhase ("Draw Phase").AddAction(new EndPhaseAction("End Phase"));
                    game.GetRuleset ("Standard").GetPhase("Draw Phase").AddAction(new SubtractResourceAction("Damage","Life Points", 5));

                    game.GetRuleset ("Standard").GetPhase ("Play Phase").AddAction(new EndGameAction("End Game"));

            return game;
        }
Example #4
0
 public override void SetObject(CGME.CGObject cgobj)
 {
     CGME_game = (CGME.Game)cgobj;
 }
Example #5
0
 public void SetGame(Game g)
 {
     this.game = g;
 }
Example #6
0
        // inicia os parametros do jogo
        // PUBLIC FUNCTIONS ------------------------------------------
        public bool Start()
        {
            Debug.Log("GM start");
            game = GameBuilder.Build();

            if (game == null){
                Debug.Log("Error - game failed to load");
                return false;
            }

            game.Enable (true);

            for (int rule_index = 0; rule_index < game.Phases_Size; rule_index++){ // FOR EACH PHASE

                    CGME.Phase phase = game.GetPhase(rule_index);
                    Debug.Log ("-----PHASE: " + phase.Name + DebugRes(phase));

                    for (int phase_index = 0; phase_index < phase.Actions_Size; phase_index++) {// FOR EACH ACTION

                        CGME.Action action = phase.GetAction(phase_index);
                        Debug.Log ("-------------ACTION:" + action.Name + DebugRes(action));
                    }

            }

            for (int game_index = 0; game_index < game.Players_Size; game_index++){ // FOR EACH PLAYER

                CGME.Player player = game.GetPlayer (game_index);
                Debug.Log ("PLAYER: " + player.Name + DebugRes(player));

                for (int player_index = 0; player_index < player.Decks_Size; player_index++){ // FOR EACH DECK

                    CGME.Deck deck = player.GetDeck(player_index);
                    Debug.Log ("------DECK: " + deck.Name + DebugRes(deck));

                    for (int deck_index = 0; deck_index < deck.Cards_Size; deck_index++) {// FOR EACH CARD

                        CGME.Card card = deck.GetCard(deck_index);
                        Debug.Log ("--------------CARD:" + card.Name + DebugRes(card));

                    }
                }
            }

            if (!DefinePhase(game.GetPhase(0))) // play the first phase by default
                return false;

            return true;
        }