Files
match3-unity/Assets/Scripts/Models/Gem.cs
2025-12-17 00:55:30 +08:00

30 lines
914 B
C#

using Enums;
using Structs;
using UnityEngine;
namespace Services {
public class Gem {
private readonly GemType type;
private Vector2Int position;
public GemType Type => this.type;
public Vector2Int Position => this.position;
private readonly int scoreValue;
public int ScoreValue => this.scoreValue;
private readonly GemType colorType;
public GemType MatchColor => this.type == GemType.Bomb ? this.colorType : this.type;
public Gem(GemType type, Vector2Int position, GemTypeValues gemValue, GemType? colorType = null) {
this.type = type;
this.position = position;
this.scoreValue = gemValue.scoreValue;
this.colorType = colorType ?? type;
}
public void SetPosition(Vector2Int position) {
this.position = position;
}
}
}