aboutsummaryrefslogtreecommitdiff
path: root/source/game/planets/BlockState.cs
blob: e7d4be0b12838f789d85b5067146476f35f9480c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using Celesteia.Game.Components.Items;
using Celesteia.Resources;
using Celesteia.Resources.Sprites;
using Celesteia.Resources.Types;

namespace Celesteia.Game.Planets {
    public struct BlockState {
        public static BlockState None = new BlockState() { Empty = true };

        public bool Empty;

        private byte _id;
        public byte BlockID {
            get => _id;
            set {
                _id = value;
                Type = ResourceManager.Blocks.GetBlock(BlockID) as BlockType;

                Empty = _id == 0;
                Translucent = Type.Translucent;
                Frames = Type.Frames;
            }
        }

        public BlockType Type { get; private set; }
        public bool Translucent { get; private set; }
        public BlockFrames Frames { get; private set; }
        
        public int BreakProgress;

        public bool Draw;
        public bool HasFrames() => Frames != null;

        public BlockData Data;
        public bool HasData() => Data != null;
    }

    public class BlockData {}
    public class TileEntity : BlockData {}
    public class Container : TileEntity {
        public Inventory inventory;
    }
}