Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
875 B
7
Indexable
using Axvemi.Worlds;
using Newtonsoft.Json;

namespace Axvemi.Buildings
{
    /// <summary>
    /// Base data for a built object
    /// </summary>
    public abstract class BuiltObject
    {
        [JsonProperty]
        private int id;

        [JsonIgnore]
        public BuiltObjectData BuiltObjectData { get; set; }

        [JsonProperty("tile")]
        public Tile Tile { get; set;}

        [JsonConstructor]
        public BuiltObject(int id, Tile tile) {
            this.id = id;
            this.BuiltObjectData = ResourceDatabaseManager.GetBuiltObjectSOById(id);
            this.Tile = tile;
        }
        
        public BuiltObject(BuiltObjectData builtObjectData, Tile tile) {
            this.BuiltObjectData = builtObjectData;
            this.id = builtObjectData.Id;
            this.Tile = tile;
        }
    }
}