Exemplo n.º 1
0
        public GameMatrix(Rectangle[,] regions, int w, int h)
        {
            rnd = new Random();

            this.w = w;
            this.h = h;

            AGameObject left    = null;
            AGameObject current = null;

            gFactory = GameObjectFactory.GetInstance();

            for (int i = 0; i < w; i++)
            {
                current = gFactory.GetGameObject(regions[i, 0], this, null, null, current);

                left = current;

                if (i == 0)
                {
                    first = current;
                }

                for (int j = 1; j < h; j++)
                {
                    var top = (left.Top != null && left.Top.Right != null) ? left.Top.Right : null;

                    var ni = gFactory.GetGameObject(regions[i, j], this, left, null, top);

                    ni.Value = new Point(i, j);

                    left = ni;
                }
            }
        }
Exemplo n.º 2
0
        public GameMatrix()
        {
            rnd = new Random();

            AGameObject left    = null;
            AGameObject current = null;

            gFactory = GameObjectFactory.GetInstance();

            for (int i = 0; i < w; i++)
            {
                current = gFactory.GetGameObject(Rectangle.Empty, this, null, null, current);

                current.Value = new Point(i, 0);

                left = current;

                if (i == 0)
                {
                    first = current;
                }

                for (int j = 1; j < h; j++)
                {
                    var top = (left.Top != null && left.Top.Right != null) ? left.Top.Right : null;

                    var ni = gFactory.GetGameObject(Rectangle.Empty, this, left, null, top);

                    ni.Value = new Point(i, j);

                    left = ni;
                }
            }
        }
Exemplo n.º 3
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();
        }