/// <summary>
 /// Construct new ExponentialDoubleAnimation with given arguments
 /// </summary>
 /// <param name="from">Animate from this value</param>
 /// <param name="to">To this value</param>
 /// <param name="power">With this exponential power</param>
 /// <param name="behavior">Using this type of behavior</param>
 /// <param name="duration">For this long</param>
 public ExponentialDoubleAnimation(double from, double to, double power, EdgeBehavior behavior, Duration duration) {
     this.EdgeBehavior = behavior;
     this.Duration = duration;
     this.Power = power;
     this.From = from;
     this.To = to;
 }
 /// <summary>
 /// Construct new ExponentialDoubleAnimation with given arguments
 /// </summary>
 /// <param name="from">Animate from this value</param>
 /// <param name="to">To this value</param>
 /// <param name="power">With this exponential power</param>
 /// <param name="behavior">Using this type of behavior</param>
 /// <param name="duration">For this long</param>
 public MesExponentialDoubleAnimation(Double from, Double to, Double power, EdgeBehavior behavior, Duration duration)
 {
     EdgeBehavior = behavior;
     Duration     = duration;
     Power        = power;
     From         = from;
     To           = to;
 }
Exemple #3
0
 /// <summary>
 /// Construct new ExponentialDoubleAnimation with given arguments
 /// </summary>
 /// <param name="from">Animate from this value</param>
 /// <param name="to">To this value</param>
 /// <param name="power">With this exponential power</param>
 /// <param name="behavior">Using this type of behavior</param>
 /// <param name="duration">For this long</param>
 public ExponentialDoubleAnimation(double from, double to, double power, EdgeBehavior behavior, Duration duration)
 {
     this.EdgeBehavior = behavior;
     this.Duration     = duration;
     this.Power        = power;
     this.From         = from;
     this.To           = to;
 }
Exemple #4
0
        public static int[,] Tile(bool[,] bits, Func <int> tileDecider, Action <int> tileOutput, int tileWidth, int tileHeight, EdgeBehavior edges)
        {
            int boundsX = bits.GetLength(0);
            int boundsY = bits.GetLength(1);

            int[,] tiles = new int[boundsX, boundsY];

            for (TileX = 0; TileX < boundsX; TileX++)
            {
                for (TileY = 0; TileY < boundsY; TileY++)
                {
                    if (bits[TileX, TileY])
                    {
                        switch (edges)
                        {
                        case EdgeBehavior.True:
                            Left  = TileX == 0 ? true : bits[TileX - 1, TileY];
                            Right = TileX == boundsX - 1 ? true : bits[TileX + 1, TileY];
                            Up    = TileY == 0 ? true : bits[TileX, TileY - 1];
                            Down  = TileY == boundsY - 1 ? true : bits[TileX, TileY + 1];

                            UpLeft    = (TileX == 0 || TileY == 0) ? true : bits[TileX - 1, TileY - 1];
                            UpRight   = (TileX == boundsX - 1 || TileY == 0) ? true : bits[TileX + 1, TileY - 1];
                            DownLeft  = (TileX == 0 || TileY == boundsY - 1) ? true : bits[TileX - 1, TileY + 1];
                            DownRight = (TileX == boundsX - 1 || TileY == boundsY - 1) ? true : bits[TileX + 1, TileY + 1];
                            break;

                        case EdgeBehavior.False:
                            Left  = TileX == 0 ? false : bits[TileX - 1, TileY];
                            Right = TileX == boundsX - 1 ? false : bits[TileX + 1, TileY];
                            Up    = TileY == 0 ? false : bits[TileX, TileY - 1];
                            Down  = TileY == boundsY - 1 ? false : bits[TileX, TileY + 1];

                            UpLeft    = (TileX == 0 || TileY == 0) ? false : bits[TileX - 1, TileY - 1];
                            UpRight   = (TileX == boundsX - 1 || TileY == 0) ? false : bits[TileX + 1, TileY - 1];
                            DownLeft  = (TileX == 0 || TileY == boundsY - 1) ? false : bits[TileX - 1, TileY + 1];
                            DownRight = (TileX == boundsX - 1 || TileY == boundsY - 1) ? false : bits[TileX + 1, TileY + 1];
                            break;

                        case EdgeBehavior.Wrap:
                            Left  = bits[(TileX + boundsX - 1) % boundsX, TileY];
                            Right = bits[(TileX + 1) % boundsX, TileY];
                            Up    = bits[TileX, (TileY + boundsY - 1) % boundsY];
                            Down  = bits[TileX, (TileY + 1) % boundsY];

                            UpLeft    = bits[(TileX + boundsX - 1) % boundsX, (TileY + boundsY - 1) % boundsY];
                            UpRight   = bits[(TileX + 1) % boundsX, (TileY + boundsY - 1) % boundsY];
                            DownLeft  = bits[(TileX + boundsX - 1) % boundsX, (TileY + 1) % boundsY];
                            DownRight = bits[(TileX + 1) % boundsX, (TileY + 1) % boundsY];
                            break;
                        }

                        int tile = tileDecider();
                        tileOutput(tile);
                        tiles[TileX, TileY] = tile;
                    }
                    else
                    {
                        tiles[TileX, TileY] = -1;
                    }
                    Console.Write(TileX);
                    Console.Write(" ");
                    Console.Write(TileY);
                    Console.Write(" :");
                    Console.WriteLine(tiles[TileX, TileY]);
                }
            }

            return(tiles);
        }
Exemple #5
0
 public static int[,] Tile(bool[,] bits, bool[,] mask, AutotileData autotileData, Action <int> tileOutput, int tileWidth, int tileHeight, EdgeBehavior edges)
 {
     return(Tile(bits, mask, autotileData.TileHandler, tileOutput, tileWidth, tileHeight, edges));
 }
Exemple #6
0
        static public int[,] Tile(bool[,] bits, Func <int> tileHandler, Tilemap tilemap, int tileWidth, int tileHeight, EdgeBehavior edges)
        {
            int boundsX = bits.GetLength(0);
            int boundsY = bits.GetLength(1);

            int[,] tiles = new int[boundsX, boundsY];

            for (TileX = 0; TileX < boundsX; TileX++)
            {
                for (TileY = 0; TileY < boundsY; TileY++)
                {
                    if (bits[TileX, TileY])
                    {
                        switch (edges)
                        {
                        case EdgeBehavior.True:
                            Left  = TileX == 0 ? true : bits[TileX - 1, TileY];
                            Right = TileX == boundsX - 1 ? true : bits[TileX + 1, TileY];
                            Up    = TileY == 0 ? true : bits[TileX, TileY - 1];
                            Down  = TileY == boundsY - 1 ? true : bits[TileX, TileY + 1];

                            UpLeft    = (TileX == 0 || TileY == 0) ? true : bits[TileX - 1, TileY - 1];
                            UpRight   = (TileX == boundsX - 1 || TileY == 0) ? true : bits[TileX + 1, TileY - 1];
                            DownLeft  = (TileX == 0 || TileY == boundsY - 1) ? true : bits[TileX - 1, TileY + 1];
                            DownRight = (TileX == boundsX - 1 || TileY == boundsY - 1) ? true : bits[TileX + 1, TileY + 1];
                            break;

                        case EdgeBehavior.False:
                            Left  = TileX == 0 ? false : bits[TileX - 1, TileY];
                            Right = TileX == boundsX - 1 ? false : bits[TileX + 1, TileY];
                            Up    = TileY == 0 ? false : bits[TileX, TileY - 1];
                            Down  = TileY == boundsY - 1 ? false : bits[TileX, TileY + 1];

                            UpLeft    = (TileX == 0 || TileY == 0) ? false : bits[TileX - 1, TileY - 1];
                            UpRight   = (TileX == boundsX - 1 || TileY == 0) ? false : bits[TileX + 1, TileY - 1];
                            DownLeft  = (TileX == 0 || TileY == boundsY - 1) ? false : bits[TileX - 1, TileY + 1];
                            DownRight = (TileX == boundsX - 1 || TileY == boundsY - 1) ? false : bits[TileX + 1, TileY + 1];
                            break;

                        case EdgeBehavior.Wrap:
                            Left  = bits[(TileX + boundsX - 1) % boundsX, TileY];
                            Right = bits[(TileX + 1) % boundsX, TileY];
                            Up    = bits[TileX, (TileY + boundsY - 1) % boundsY];
                            Down  = bits[TileX, (TileY + 1) % boundsY];

                            UpLeft    = bits[(TileX + boundsX - 1) % boundsX, (TileY + boundsY - 1) % boundsY];
                            UpRight   = bits[(TileX + 1) % boundsX, (TileY + boundsY - 1) % boundsY];
                            DownLeft  = bits[(TileX + boundsX - 1) % boundsX, (TileY + 1) % boundsY];
                            DownRight = bits[(TileX + 1) % boundsX, (TileY + 1) % boundsY];
                            break;
                        }

                        int tile = tileHandler();
                        if (tile != -1)
                        {
                            tilemap.DrawTile(tile, TileX * tileWidth, TileY * tileHeight);
                        }
                        tiles[TileX, TileY] = tile;
                    }
                }
            }

            return(tiles);
        }
Exemple #7
0
 static public int[,] Tile(bool[,] bits, bool[,] also, AutotileData autotileData, Tilemap tilemap, int tileWidth, int tileHeight, EdgeBehavior edges)
 {
     return(Tile(bits, also, autotileData.TileHandler, tilemap, tileWidth, tileHeight, edges));
 }
Exemple #8
0
 public static int[,] Tile(bool[,] bits, bool[,] also, AutotileData autotileData, Tilemap tilemap, int tileWidth, int tileHeight, EdgeBehavior edges)
 {
     return Tile(bits, also, autotileData.TileHandler, tilemap, tileWidth, tileHeight, edges);
 }
Exemple #9
0
        public static int[,] Tile(bool[,] bits, bool[,] also, Func<int> tileHandler, Tilemap tilemap, int tileWidth, int tileHeight, EdgeBehavior edges)
        {
            int boundsX = bits.GetLength(0);
            int boundsY = bits.GetLength(1);
            int[,] tiles = new int[boundsX, boundsY];

            for (TileX = 0; TileX < boundsX; TileX++)
            {
                for (TileY = 0; TileY < boundsY; TileY++)
                {
                    if (bits[TileX, TileY])
                    {
                        switch (edges)
                        {
                            case EdgeBehavior.True:
                                Left = TileX == 0 ? true : bits[TileX - 1, TileY] || also[TileX - 1, TileY];
                                Right = TileX == boundsX - 1 ? true : bits[TileX + 1, TileY] || also[TileX + 1, TileY];
                                Up = TileY == 0 ? true : bits[TileX, TileY - 1] || also[TileX, TileY - 1];
                                Down = TileY == boundsY - 1 ? true : bits[TileX, TileY + 1] || also[TileX, TileY + 1];

                                UpLeft = (TileX == 0 || TileY == 0) ? true : bits[TileX - 1, TileY - 1] || also[TileX - 1, TileY - 1];
                                UpRight = (TileX == boundsX - 1 || TileY == 0) ? true : bits[TileX + 1, TileY - 1] || also[TileX + 1, TileY - 1];
                                DownLeft = (TileX == 0 || TileY == boundsY - 1) ? true : bits[TileX - 1, TileY + 1] || also[TileX - 1, TileY + 1];
                                DownRight = (TileX == boundsX - 1 || TileY == boundsY - 1) ? true : bits[TileX + 1, TileY + 1] || also[TileX + 1, TileY + 1];
                                break;

                            case EdgeBehavior.False:
                                Left = TileX == 0 ? false : bits[TileX - 1, TileY] || also[TileX - 1, TileY];
                                Right = TileX == boundsX - 1 ? false : bits[TileX + 1, TileY] || also[TileX + 1, TileY];
                                Up = TileY == 0 ? false : bits[TileX, TileY - 1] || also[TileX, TileY - 1];
                                Down = TileY == boundsY - 1 ? false : bits[TileX, TileY + 1] || also[TileX, TileY + 1];

                                UpLeft = (TileX == 0 || TileY == 0) ? false : bits[TileX - 1, TileY - 1] || also[TileX - 1, TileY - 1];
                                UpRight = (TileX == boundsX - 1 || TileY == 0) ? false : bits[TileX + 1, TileY - 1] || also[TileX + 1, TileY - 1];
                                DownLeft = (TileX == 0 || TileY == boundsY - 1) ? false : bits[TileX - 1, TileY + 1] || also[TileX - 1, TileY + 1];
                                DownRight = (TileX == boundsX - 1 || TileY == boundsY - 1) ? false : bits[TileX + 1, TileY + 1] || also[TileX + 1, TileY + 1];
                                break;

                            case EdgeBehavior.Wrap:
                                Left = bits[(TileX + boundsX - 1) % boundsX, TileY] || also[(TileX + boundsX - 1) % boundsX, TileY];
                                Right = bits[(TileX + 1) % boundsX, TileY] || also[(TileX + 1) % boundsX, TileY];
                                Up = bits[TileX, (TileY + boundsY - 1) % boundsY] || also[TileX, (TileY + boundsY - 1) % boundsY];
                                Down = bits[TileX, (TileY + 1) % boundsY] || also[TileX, (TileY + 1) % boundsY];

                                UpLeft = bits[(TileX + boundsX - 1) % boundsX, (TileY + boundsY - 1) % boundsY] || also[(TileX + boundsX - 1) % boundsX, (TileY + boundsY - 1) % boundsY];
                                UpRight = bits[(TileX + 1) % boundsX, (TileY + boundsY - 1) % boundsY] || also[(TileX + 1) % boundsX, (TileY + boundsY - 1) % boundsY];
                                DownLeft = bits[(TileX + boundsX - 1) % boundsX, (TileY + 1) % boundsY] || also[(TileX + boundsX - 1) % boundsX, (TileY + 1) % boundsY];
                                DownRight = bits[(TileX + 1) % boundsX, (TileY + 1) % boundsY] || also[(TileX + 1) % boundsX, (TileY + 1) % boundsY];
                                break;
                        }

                        int tile = tileHandler();
                        if (tile != -1)
                            tilemap.DrawTile(tile, TileX * tileWidth, TileY * tileHeight);
                        tiles[TileX, TileY] = tile;
                    }
                }
            }

            return tiles;
        }