示例#1
0
 public static void UpdateGemTexture(Gem gem)
 {
     if (gem != null)
     {
         gem.Texture = gem.IsClicked ? TextureController.GetTexture(gem.Type.SelectedSpritePath())
                                     : TextureController.GetTexture(gem.Type.SpritePath());
     }
 }
示例#2
0
        public static Gem GetNewGem(Vector2 position, GemType type)
        {
            Gem newGem = new Gem()
            {
                Position   = position,
                Texture    = TextureController.GetTexture(type.SpritePath()),
                IsClicked  = false,
                ScorePrice = DefaultSettings.GemScore,
                Type       = type,
                WasMoved   = false
            };

            return(newGem);
        }
示例#3
0
        public static FieldCell GenerateNewFieldCell(int column, int row, Random random, EventHandler onClick)
        {
            var cell = new FieldCell
            {
                Id       = (column + 1) + 8 * row,
                Column   = column,
                Row      = row,
                Position = new Vector2(DefaultCell.Width * column, DefaultCell.Height * 2 + DefaultCell.Height * row),
                Texture  = TextureController.GetTexture(BackgroundType.Ground.SpritePath())
            };

            cell.Click += onClick;

            var type = (GemType)random.Next(1, 6);

            cell.Gem = GemsController.GetNewGem(cell.Position, type);

            return(cell);
        }