Untitled

 avatar
unknown
plain_text
2 years ago
1.1 kB
6
Indexable
using Axvemi.Buildings;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using UnityEngine;

namespace Axvemi.Worlds {

    public class Tile {

        [JsonIgnore]
        public Action<Tile, BuiltObject> onTileInstalledObjectUpdated;


        [JsonProperty]
        public BuiltObject FloorObject { get; set; }


        //Local Positions
        [JsonProperty]
        public int X { get; set; }
        [JsonProperty]
        public int Y { get; set; }
        [JsonProperty]
        public int Z { get; set; }

        [JsonConstructor]
        public Tile(InstalledObject installedObject) {
            if(installedObject != null) {
                this.InstalledObject = installedObject;
                installedObject.Tile = this;
            }
        }

        public Tile(Chunk chunk, int x, int y, int z) {
            this.Chunk = chunk;
            this.X = x;
            this.Y = y;
            this.Z = z;
        }

        public override string ToString()
        {
            return "X: " + X + ", Y:" + Y + ", Z:" + Z;
        }
}