Beispiel #1
0
 public MoveCommand(FigureLocation fromLocation, Vector2Int fromPosition,
                    FigureLocation toLocation, Vector2Int toPosition, bool handle)
 {
     this.fromLocation = fromLocation;
     this.fromPosition = fromPosition;
     this.toLocation   = toLocation;
     this.toPosition   = toPosition;
     this.handle       = handle;
 }
        public override baseFigure NextLocation()
        {
            FigureLocation l           = this.lockation;
            FigureLocation newLocation = (int)l == 3 ? FigureLocation.Up : l + 1;
            Color          c           = Color.Violet;

            for (int i = 0; i < this.fi.GetLength(0); i++)
            {
                for (int j = 0; j < this.fi.GetLength(1); j++)
                {
                    if (fi[i, j].Color != Color.White)
                    {
                        c = fi[i, j].Color;
                    }
                }
            }
            StartPosition position = this.position;

            _7 bf = new _7(7, c, newLocation, position);

            L[] a = new L[4];
            if (l == FigureLocation.Up)
            {
                a[0].i = 0; a[0].j = 0;
                a[1].i = 1; a[1].j = 0;
                a[2].i = 2; a[2].j = 0;
                a[3].i = 1; a[3].j = 1;
            }
            if (l == FigureLocation.Right)
            {
                a[0].i = 1; a[0].j = 0;
                a[1].i = 1; a[1].j = 1;
                a[2].i = 1; a[2].j = 2;
                a[3].i = 0; a[3].j = 1;
            }
            if (l == FigureLocation.Down)
            {
                a[0].i = 0; a[0].j = 1;
                a[1].i = 1; a[1].j = 1;
                a[2].i = 2; a[2].j = 1;
                a[3].i = 1; a[3].j = 0;
            }
            if (l == FigureLocation.Left)
            {
                a[0].i = 0; a[0].j = 0;
                a[1].i = 0; a[1].j = 1;
                a[2].i = 0; a[2].j = 2;
                a[3].i = 1; a[3].j = 1;
            }
            bf.ShangeFi(a, c);
            return(bf);
        }
Beispiel #3
0
        public void InitItem(int x_position, int y_position, FigureItemType type, FigureLocation location)
        {
            if (wasInited)
            {
                return;
            }

            Position   = new Vector2Int(x_position, y_position);
            FigureType = type;
            Location   = location;

            wasInited = true;
        }
        public baseFigure(int N, Color c, FigureLocation f, StartPosition position)
        {
            number        = N;
            lockation     = f;
            this.position = position;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    fi[i, j] = Square.Empty;
                }
            }
        }
 _7(int N, Color c, FigureLocation f, StartPosition position)
     : base(N, c, f, position)
 {
 }