Exemple #1
0
        public PlayController() : base(ControllerNames.Play)
        {
            Rectangle[,] regions = new Rectangle[8, 8];

            gc = GameConfigs.GetInstance();

            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    regions[i, j] = new Rectangle(gc.GetRealPoint(j + 1, i + 1), new Point(gc.RegionWidth, gc.RegionHeight));
                }
            }

            gameMatrix = new GameMatrix(regions, 8, 8);

            gameModel = new GameModel(gameMatrix);

            gameMatrix.OnItemKilled += () =>
            {
                bonusPointsModel.Points += 1;
            };

            gameTimerModel        = new GameTimerModel();
            bonusPointsModel      = new BonusPointsModel();
            gameModel.Timer       = gameTimerModel;
            gameModel.BonusPoints = bonusPointsModel;

            renderer = new PlayRenderer(gameModel);

            gameTimerModel.Start();
        }
 public LineBonusEffect(LineBonusEffectDirection direction)
 {
     Direction = direction;
     gc        = GameConfigs.GetInstance();
     State     = DynamicState.RUN;
     BonusType = direction == LineBonusEffectDirection.BT || direction == LineBonusEffectDirection.TB ? BonusEffect.LINE_V : BonusEffect.LINE_H;
 }
 public GameTimerModel()
 {
     gc       = GameConfigs.GetInstance();
     Region   = new Rectangle(gc.GetRealPoint(7.5f, 0.5f), new Point(0, 0));
     position = new Vector2(Region.X, Region.Y);
     State    = DynamicState.END;
 }
Exemple #4
0
        public AGameObject(Rectangle region, SpriteName spriteName, GameMatrix parent, AGameObject left = null, AGameObject right = null, AGameObject top = null, AGameObject bottom = null)
        {
            Region = region;

            this.Parent = parent;

            NewPosition = new Point(region.X, region.Y);

            SpriteName = spriteName;

            Left   = left;
            Right  = right;
            Top    = top;
            Bottom = bottom;

            Visible = true;

            if (Left != null)
            {
                Left.Right = this;
            }
            if (Right != null)
            {
                Right.Left = this;
            }
            if (Top != null)
            {
                Top.Bottom = this;
            }
            if (Bottom != null)
            {
                Bottom.Top = this;
            }

            AnimationState      = SpriteAnimationState.SHOW;
            SpriteAnimationStep = 8;

            gFactory = GameObjectFactory.GetInstance();
            gc       = GameConfigs.GetInstance();
        }
Exemple #5
0
 public PlayButtonModel()
 {
     tHelper = TextureHelper.GetInstance();
     gc      = GameConfigs.GetInstance();
     Region  = new Rectangle(gc.Center.X - 101, gc.Center.Y - 25, 202, 50);
 }
 public BonusPointsModel()
 {
     gc       = GameConfigs.GetInstance();
     Region   = new Rectangle(gc.GetRealPoint(1, 0.5f), new Point(0, 0));
     position = new Vector2(Region.X, Region.Y);
 }
Exemple #7
0
        Program()
        {
            Rectangle[,] gObjects = new Rectangle[8, 8];

            GameConfigs.GetInstance().RegionWidth  = 1;
            GameConfigs.GetInstance().RegionHeight = 1;


            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    gObjects[i, j] = new Rectangle(j, i, 256, 256);
                }
            }

            var matrix = new GameMatrix(gObjects, 8, 8);

            Console.WriteLine("Input matrix");
            Console.WriteLine(matrix.ToString());
            Console.WriteLine();
            Console.WriteLine("Matrix items positions");
            Console.WriteLine(matrix.GetItemsPositions());
            Console.WriteLine();

            bool busy = true;

            while (busy || matrix.State != MatrixState.NONE)
            {
                while (busy)
                {
                    busy = false;
                    foreach (var go in matrix)
                    {
                        go.Update(100);
                        busy |= go.IsBusy();
                    }
                }

                matrix.Next();

                busy = true;

                while (busy)
                {
                    busy = false;
                    foreach (var go in matrix)
                    {
                        go.Update(100);
                        busy |= go.IsBusy();
                    }
                }


                Console.WriteLine("Test killed items:");
                Console.WriteLine(matrix.ToString());

                Console.WriteLine();
                Console.WriteLine("Matrix items positions");
                Console.WriteLine(matrix.GetItemsPositions());
                Console.WriteLine();

                busy = true;

                while (busy)
                {
                    busy = false;
                    foreach (var go in matrix)
                    {
                        go.Update(100);
                        busy |= go.IsBusy();
                    }
                }


                matrix.Next();

                Console.WriteLine("Test drop down items");
                Console.WriteLine(matrix.ToString());
                Console.WriteLine();
                Console.WriteLine("Matrix items positions");
                Console.WriteLine(matrix.GetItemsPositions());
                Console.WriteLine();

                busy = true;

                while (busy)
                {
                    busy = false;
                    foreach (var go in matrix)
                    {
                        go.Update(100);
                        busy |= go.IsBusy();
                    }
                }

                matrix.Next();

                Console.WriteLine("Create new items");
                Console.WriteLine(matrix.ToString());
                Console.WriteLine();

                Console.WriteLine("Test matrix state");
                Console.WriteLine(matrix.State);
                Console.WriteLine();
                Console.WriteLine("Matrix items positions");
                Console.WriteLine(matrix.GetItemsPositions());
                Console.WriteLine();

                Console.WriteLine("+++++++++++++++++++++++");
            }

            /*while(matrix.State != MatrixState.NONE)
             * {
             *  matrix.Next();
             *  Console.WriteLine("Test matrix state");
             *  Console.WriteLine(matrix.State);
             * }
             *
             *
             * Console.WriteLine("Matrix");
             * Console.WriteLine(matrix.ToString());
             *
             * Console.WriteLine();
             *
             *
             * Console.WriteLine();
             * Console.WriteLine("Test h swap");
             * Console.WriteLine(matrix.ToString());
             * matrix.TestHSwap();
             * Console.WriteLine(matrix.ToString());*/

            Console.ReadLine();
        }
 public GameOverDialogModel()
 {
     gc         = GameConfigs.GetInstance();
     SpriteName = SpriteName.GameOverBG;
     Region     = new Rectangle(gc.Center.X - 200, gc.Center.Y - 100, 400, 200);
 }
Exemple #9
0
 public GameOverButton()
 {
     gc         = GameConfigs.GetInstance();
     Region     = new Rectangle(gc.Center.X - 50, gc.Center.Y + 20, 100, 30);
     SpriteName = SpriteName.GameOverButton;
 }
 public WaitBangEffect()
 {
     gc        = GameConfigs.GetInstance();
     BonusType = BonusEffect.WAIT_BANG;
 }
Exemple #11
0
 public PlayRenderer(GameModel gm)
 {
     gameModel = gm;
     gc        = GameConfigs.GetInstance();
     tHelper   = TextureHelper.GetInstance();
 }
Exemple #12
0
 public BangBonusEffect()
 {
     BonusType = BonusEffect.BANG;
     gc        = GameConfigs.GetInstance();
 }