Example #1
0
 public override Sprites.Sprite GetSprite(
     Material topLeft, Material top, Material topRight,
     Material left, Material right,
     Material bottomLeft, Material bottom, Material bottomRight)
 {
     if (top == this)
     {
         return m_center;
     }
     else if (bottom == this)
     {
         if (left == this)
         {
             if (right == this)
             {
                 return m_top;
             }
             else
             {
                 return m_topRight;
             }
         }
         else
         {
             if (right == this)
             {
                 return m_topLeft;
             }
             else
             {
                 return m_topSingle;
             }
         }
     }
     else
     {
         if (left == this)
         {
             if (right == this)
             {
                 return m_top;
             }
             else
             {
                 return m_right;
             }
         }
         else
         {
             if (right == this)
             {
                 return m_left;
             }
             else
             {
                 return m_topSingle;
             }
         }
     }
 }
Example #2
0
 public override Sprites.Sprite GetSprite(Material topLeft, Material top, Material topRight, Material left, Material right, Material bottomLeft, Material bottom, Material bottomRight)
 {
     if (top == this)
     {
         return m_mid;
     }
     else
     {
         return m_top;
     }
 }
Example #3
0
        public Level()
        {
            var reader = new StreamReader(this.GetType().GetAssociatedResource("txt"));
            var lines = new List<string[]>();

            string line;
            int width = 0;

            while ((line = reader.ReadLine()) != null)
            {
                if (!string.IsNullOrWhiteSpace(line))
                {
                    var tokens = line.Split('|');
                    lines.Add(tokens);
                    width = Math.Max(width, tokens.Length);
                }
            }

            lines.Reverse();

            var mats = new Material[width, lines.Count];

            for (int y = 0; y < lines.Count; y++)
            {
                var l = lines[y];

                for (int x = 0; x < l.Length; x++)
                {
                    var desc = l[x];

                    if (desc == "GR")
                    {
                        mats[x, y] = Grass.Instance;
                    }
                    else if (desc == "CA")
                    {
                        mats[x, y] = Castle.Instance;
                    }
                    else if (desc == "WA")
                    {
                        mats[x, y] = Water.Instance;
                    }
                    else if (desc == "LA")
                    {
                        mats[x, y] = Lava.Instance;
                    }
                }
            }

            Map = new Map(mats);
        }
Example #4
0
 public abstract Sprite GetSprite(
     Material topLeft, Material top, Material topRight,
     Material left, Material right,
     Material bottomLeft, Material bottom, Material bottomRight);