miepzerino
2025-03-30 d2ab30e7a69bfe7efda63ae75812207377917bd3
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using UnityEngine;
 
namespace Flexalon
{
    /// <summary> Specifies which cell a gameObject should occupy in a grid layout. </summary>
    [AddComponentMenu("Flexalon/Flexalon Grid Cell"), HelpURL("https://www.flexalon.com/docs/gridLayout")]
    public class FlexalonGridCell : FlexalonComponent
    {
        [SerializeField, Min(0)]
        private int _column;
        /// <summary> The column of the cell. </summary>
        public int Column
        {
            get => _column;
            set
            {
                _column = Mathf.Max(0, value);
                MarkDirty();
            }
        }
 
        [SerializeField, Min(0)]
        private int _row;
        /// <summary> The row of the cell. </summary>
        public int Row
        {
            get => _row;
            set
            {
                _row = Mathf.Max(0, value);
                MarkDirty();
            }
        }
 
        [SerializeField, Min(0)]
        private int _layer;
        /// <summary> The layer of the cell. </summary>
        public int Layer
        {
            get => _layer;
            set
            {
                _layer = Mathf.Max(0, value);
                MarkDirty();
            }
        }
 
        /// <summary> The cell to occupy. </summary>
        public Vector3Int Cell
        {
            get => new Vector3Int(_column, _row, _layer);
            set
            {
                _column = Mathf.Max(0, value.x);
                _row = Mathf.Max(0, value.y);
                _layer = Mathf.Max(0, value.z);
                MarkDirty();
            }
        }
    }
}