Пример #1
0
        public void SetTile(int i, int j, Tile tileType)
        {
            if (i < 0 || i >= Width || j < 0 || j >= Height)
            {
                return;
            }
            if (mTiles[i, j] == tileType)
            {
                return;
            }

            if (mTiles[i, j] == Tile.Water && !ObjectManager.Instance.CheckTile(new Vector2(i, j), typeof(IPathCollidable)).Any())
            {
                GameGraph.RemoveCollision(new Vector2(i, j));
            }
            else if (tileType == Tile.Water)
            {
                GameGraph.AddCollision(new Vector2(i, j));
            }
            mTiles[i, j] = tileType;

            for (var k = i - 1; k <= i + 1; k++)
            {
                for (var l = j - 1; l <= j + 1; l++)
                {
                    UpdateTileTexture(k, l);
                }
            }
        }
Пример #2
0
 public bool Start(int startValue, GameGraph g)
 {
     Domino match = _hand.Where(d => d.IsDouble()).FirstOrDefault(d => d.Matches(startValue));
     if (match == null) return false;
     Global.Logger.Comment(string.Format("{0} started {1}", Name(), match));
     _hand.Remove(match);
     g.Start(match);
     return true;
 }
Пример #3
0
        public bool Start(int startValue, GameGraph g)
        {
            Domino match = _hand.Where(d => d.IsDouble()).FirstOrDefault(d => d.Matches(startValue));

            if (match == null)
            {
                return(false);
            }
            Global.Logger.Comment(string.Format("{0} started {1}", Name(), match));
            _hand.Remove(match);
            g.Start(match);
            return(true);
        }
Пример #4
0
    public GameSave()
    {
        GameGraph gameGraph = new GameGraph();

        start = transition = gameGraph.StartTransition();
        mazes = gameGraph.ToMazeArray();

        bag = new Bag();

        lifePoints = maxHP;
        playTime   = 0;

        golemBossFirstTime = true;
    }
Пример #5
0
 public override async Task<bool> Play(GameGraph game, Tiles tiles)
 {
     await Task.Delay(300);
     if (!LookFormatch(game))
     {
         Draw(tiles);
         if (!LookFormatch(game)&& !Open)
         {
             Global.Logger.Comment(string.Format("{0}'s line opened", Name()));
             Open = true;
         }
     }
     return !_hand.Any();
 }
Пример #6
0
        private async Task <bool> AttemptToPlay(GameGraph game)
        {
            var ends = game.Ends(this).ToArray();

            while (true)
            {
                var end = await AwaitKey();

                if (end == null)
                {
                    Global.Logger.Comment("Skipping");
                    return(false);
                }

                Global.Logger.Comment(string.Format("You chose {0} end", end));
                if (end > ends.Count())
                {
                    Global.Logger.Comment("Invalid end");
                    continue;
                }

                var domino = await AwaitKey();

                Global.Logger.Comment(string.Format("You chose {0} domino", domino));
                if (domino > _hand.Count)
                {
                    Global.Logger.Comment("Invalid domino");
                    continue;
                }
                var d = _hand.ToArray()[domino.Value - 1];
                var e = ends[end.Value - 1];

                if (d.Matches(e.End))
                {
                    e.AddChild(d);
                    _hand.Remove(d);
                    if (e.Owner == Name())
                    {
                        Open = false;
                    }

                    Global.Logger.Comment(string.Format("{0} played {1} on {2}'s line and has {3} left", Name(), d, e.Owner, _hand.Count));
                    return(true);
                }
                else
                {
                    Global.Logger.Comment(string.Format("domino {0} doesn't match end {1}", d, e.Value));
                }
            }
        }
Пример #7
0
        //Almost identical to robot player except for where the await happens
        public override async Task <bool> Play(GameGraph game, Tiles tiles)
        {
            if (!await AttemptToPlay(game) && !_kill)
            {
                Draw(tiles);
                Game.Instance().Paint();
                await Task.Delay(300);

                if (!await AttemptToPlay(game) && !Open)
                {
                    Open = true;
                }
            }
            return(!_hand.Any());
        }
Пример #8
0
        public override async Task <bool> Play(GameGraph game, Tiles tiles)
        {
            await Task.Delay(300);

            if (!LookFormatch(game))
            {
                Draw(tiles);
                if (!LookFormatch(game) && !Open)
                {
                    Global.Logger.Comment(string.Format("{0}'s line opened", Name()));
                    Open = true;
                }
            }
            return(!_hand.Any());
        }
Пример #9
0
        //Almost identical to robot player except for where the await happens
        public override async Task<bool> Play(GameGraph game, Tiles tiles)
        {
            if (! await AttemptToPlay(game) && !_kill)
            {
                Draw(tiles);
                Game.Instance().Paint();
                await Task.Delay(300);
                if (! await AttemptToPlay(game) && !Open)
                {
                    Open = true;
                }
            }
            return !_hand.Any();

        }
Пример #10
0
        private void Begin2DMapMode()
        {
            CGameView = new Controls.View._2D.GameViewMap();
            CGameView.Show(this.dockPanel1, WeifenLuo.WinFormsUI.Docking.DockState.Document);
            CGraphTree = new Graph2D();
            CGraphTree.Show(this.dockPanel1, WeifenLuo.WinFormsUI.Docking.DockState.DockLeft);

            GGraph = new GameGraph2D();

            CGraphTree.SetGameGraph(GGraph);
            CGameView.SetGameGraph(GGraph);

            CTileSelect = new Controls.Selector.TileSelector();

            CTileSelect.Show(this.dockPanel1, WeifenLuo.WinFormsUI.Docking.DockState.DockBottom);
            EditMode = EditorMode.Game2D;
        }
Пример #11
0
 private bool LookFormatch(GameGraph game)
 {
     Match pick = _strat.Choose(_hand, game.Ends(this));            
     if (pick != null)
     {
         //use a class instead of this tuple?
         game.Add(pick.end, pick.domino, this);
         _hand.Remove(pick.domino);
         Global.Logger.Comment(string.Format("{0} played {1} on {2}'s line and has {3} left", Name(), pick.domino, pick.end.Owner, _hand.Count));
         if (Open && pick.end.Owner.Equals(this.Name()))
         {
             Global.Logger.Comment(string.Format("{0}'s line closed", Name()));
             Open = false;
         }
         return true;
     }                        
     return false;
 }
Пример #12
0
        private bool LookFormatch(GameGraph game)
        {
            Match pick = _strat.Choose(_hand, game.Ends(this));

            if (pick != null)
            {
                //use a class instead of this tuple?
                game.Add(pick.end, pick.domino, this);
                _hand.Remove(pick.domino);
                Global.Logger.Comment(string.Format("{0} played {1} on {2}'s line and has {3} left", Name(), pick.domino, pick.end.Owner, _hand.Count));
                if (Open && pick.end.Owner.Equals(this.Name()))
                {
                    Global.Logger.Comment(string.Format("{0}'s line closed", Name()));
                    Open = false;
                }
                return(true);
            }
            return(false);
        }
Пример #13
0
        private void Begin3DMapMode()
        {
            CGameView = new Controls.View._3D.GameView3D();
            CGameView.Show(this.dockPanel1, WeifenLuo.WinFormsUI.Docking.DockState.Document);
            CGraphTree = new Controls.Graph._3D.Graph3D();
            CGraphTree.Show(this.dockPanel1, WeifenLuo.WinFormsUI.Docking.DockState.DockLeft);

            GGraph = new GameGraph3D();
            CGraphTree.SetGameGraph(GGraph);

            CGameView.BindView();
            var gv3d = CGameView as Controls.View._3D.GameView3D;

            var g = gv3d.GGraph3D;

            var quad = TrinityEngine.Gen.GeoGen.Quad(100, 100);

            g.AddNode(quad);
        }
Пример #14
0
    // Cria as fases e seta as transições entre elas
    public GameGraph()
    {
        current = this;

        // OBS: sempre carregar as estáticas primeiro
        entrance   = new StaticStage(0, "Entrance");
        entrance2  = new StaticStage(1, "Entrance2");
        lockup     = new StaticStage(2, "Lockup");
        mirrorRoom = new StaticStage(3, "Mirror room");
        fireplace  = new StaticStage(4, "Fireplace");

        hallStage   = new HallStage(5, entrance.transitions [1], mirrorRoom.transitions [0]);
        caveStage   = new CaveStage(hallStage.endIndex + 1, mirrorRoom.transitions[1], fireplace.transitions[0]);
        forestStage = new ForestStage(caveStage.endIndex + 1, fireplace.transitions[1]);

        graveyard = new StaticStage(forestStage.endIndex + 1, "Graveyard");

        // Da entrada para o maze com do calabouço
        SetTransitions(entrance.transitions[2], entrance2.transitions[1]);
        SetTransitions(entrance.transitions[3], entrance2.transitions[2]);

        // Da entrada do calabouço para o calabouço em si
        SetTransitions(entrance2.transitions[0], lockup.transitions[0]);

        // Da entrada para os corredores
        SetTransitions(entrance.transitions[1], hallStage.transitions[0]);

        // Dos corredores para a caverna
        SetTransitions(hallStage.transitions[1], mirrorRoom.transitions[0]);
        SetTransitions(mirrorRoom.transitions[1], caveStage.transitions[0]);

        // Da caverna para a floresta
        SetTransitions(caveStage.transitions[1], fireplace.transitions[0]);
        SetTransitions(fireplace.transitions[1], forestStage.transitions[0]);

        CreateObstacles(hallStage.mazes);
        CreateObstacles(caveStage.mazes);
        CreateObstacles(forestStage.mazes);
    }
Пример #15
0
 //public GameProcess(GameParams param, GameGraph<Point> GameGraph)
 public void initParams(IGameParams param, AGameGraph GameGraph)
 {
     this.gr = (GameGraph <Point>)GameGraph;
     this.gm = (GoEGameParams)param;
 }
Пример #16
0
 public bool Start(int startValue, GameGraph game)
 {
     return(false);
 }
Пример #17
0
 public async Task <bool> Play(GameGraph game, Tiles tiles)
 {
     //this is a really silly way to just say return false;
     return(await Task.Factory.StartNew(() => false));
 }
Пример #18
0
 public void SetGameGraph(GameGraph graph)
 {
     GGraph = graph;
     Rebuild();
 }
Пример #19
0
 public abstract Task<bool> Play(GameGraph g, Tiles t);
Пример #20
0
        private async Task<bool> AttemptToPlay(GameGraph game)
        {
            var ends = game.Ends(this).ToArray();
            while (true)
            {
                var end = await AwaitKey();
                if (end == null)
                {
                    Global.Logger.Comment("Skipping");
                    return false;
                }

                Global.Logger.Comment(string.Format("You chose {0} end", end));
                if (end > ends.Count())
                {
                    Global.Logger.Comment("Invalid end");
                    continue;
                }
                
                var domino = await AwaitKey();
                Global.Logger.Comment(string.Format("You chose {0} domino", domino));
                if (domino > _hand.Count)
                {
                    Global.Logger.Comment("Invalid domino");
                    continue;
                }
                var d =_hand.ToArray()[domino.Value-1];
                var e = ends[end.Value-1];
                
                if (d.Matches(e.End))
                {
                    e.AddChild(d);
                    _hand.Remove(d);
                    if (e.Owner == Name())
                    {
                        Open = false;
                    }

                    Global.Logger.Comment(string.Format("{0} played {1} on {2}'s line and has {3} left", Name(), d, e.Owner, _hand.Count));
                    return true;
                }
                else
                {
                    Global.Logger.Comment(string.Format("domino {0} doesn't match end {1}", d, e.Value));
                }
            }            
        }
Пример #21
0
 public void ResetTurns()
 {
     isPlayerTurn = true;
     graph        = new GameGraph();
 }
Пример #22
0
 public bool Start(int startValue, GameGraph game)
 {
     return false;
 }
Пример #23
0
        public async Task<bool> Play(GameGraph game, Tiles tiles)
        {
 	        //this is a really silly way to just say return false;
            return await Task.Factory.StartNew(() => false);
        }
Пример #24
0
 public void SetState(GameGraph other)
 {
 }
Пример #25
0
 private GameManager()
 {
     isPlayerTurn = true;
     movesCounter = 0;
     graph        = new GameGraph();
 }
Пример #26
0
 public State()
 {
     s = new GameGraph();
 }
Пример #27
0
 abstract public Task <bool> Play(GameGraph g, Tiles t);