public Diamond(int x, int y, DiamondType type) { if (x < 0 || x > GameProperties.Field.SIZE_X || y < 0 || y > GameProperties.Field.SIZE_X) { throw new ArgumentException($"Input parameter {x} or {y} out of field"); } Type = type; Position = new Point(x * GameProperties.Cell.SIZE, y * GameProperties.Cell.SIZE + GameProperties.Window.SCORE_Y); texture = LoadTexture(); }
public IDiamond CreateDiamond(DiamondType diamondType) { switch (diamondType) { case DiamondType.Square: return(new DiamondSquare()); case DiamondType.Star: return(new DiamondStar()); case DiamondType.Circle: return(new DiamondCircle()); case DiamondType.X: return(new DiamondX()); case DiamondType.Plus: return(new DiamondPlus()); case DiamondType.Rhombus: return(new DiamondRhombus()); case DiamondType.ButterFly: return(new DiamondButterFly()); default: return(new DiamondNone()); } }
private Texture2D GetTexture <T>() where T : struct { if (typeof(T) == typeof(Costam.GoldDiamond)) { Type = DiamondType.GoldDiamond; return(Costam.goldDiamondTexture); } else if (typeof(T) == typeof(Costam.RedDiamond)) { Type = DiamondType.GoldDiamond; return(Costam.redDiamondTexture); } else if (typeof(T) == typeof(Costam.GreenDiamond)) { Type = DiamondType.GoldDiamond; return(Costam.greenDiamondTexture); } //default Type = DiamondType.GoldDiamond; return(Costam.goldDiamondTexture); }
public static PlayerDiamonds GetPlayerDiamondsByDiamondType(DiamondType diamondType) { switch (diamondType) { case DiamondType.Green: { return new PlayerDiamonds(1, 0, 0); } case DiamondType.Red: { return new PlayerDiamonds(0, 1, 0); } case DiamondType.Purple: { return new PlayerDiamonds(0, 0, 1); } default: { Debug.LogError("Unkown diamond type"); return null; } } }