예제 #1
0
 public Tree(TreeSprite sprite, int x, int y, int height)
 {
     this.sprite = sprite;
     this.x      = x;
     this.y      = y;
     this.height = height;
 }
예제 #2
0
        public static TreeSprite GetTreeSprite(TreeType treeType)
        {
            if (!dictionary.Keys.Contains(treeType))
            {
                switch (treeType)
                {
                case TreeType.Oak:
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Creating sprite of Oak...");
                    Console.ForegroundColor = ConsoleColor.Gray;
                    dictionary.Add(treeType, new TreeSprite("Oak.png", treeType));
                    break;

                case TreeType.Pine:
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Creating sprite of Pine...");
                    Console.ForegroundColor = ConsoleColor.Gray;
                    dictionary.Add(treeType, new TreeSprite("Pine.png", treeType));
                    break;

                case TreeType.Birch:
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("Creating sprite of Birch...");
                    Console.ForegroundColor = ConsoleColor.Gray;
                    dictionary.Add(treeType, new TreeSprite("Birch.png", treeType));
                    break;
                }
            }

            TreeSprite treeSprite = dictionary[treeType];

            return(treeSprite);
        }