Beispiel #1
0
        public IsoTileBulk Duplicate()
        {
            IsoTileBulk result = GameObject.Instantiate(this);

            result.transform.SetParent(transform.parent, false);
            result.Rename();
            Undo.RegisterCreatedObjectUndo(result.gameObject, "IsoTileBulk:Dulicate");
            return(result);
        }
Beispiel #2
0
        public void Sync(IsoTileBulk with)
        {
            //Transform, Grid, GridCoordinates 를 맞춘다
            transform.SetPositionAndRotation(with.transform.position, with.transform.rotation);
            coordinates.Sync(with.coordinates);
            coordinates.grid.Sync(with.coordinates.grid);

            transform.parent = with.transform.parent;
        }
Beispiel #3
0
        public static bool Regist(IsoTileBulk bulk)
        {
            if (IsoMap.IsNull)
            {
                return(false);
            }

            return(IsoMap.instance.Regist_Bulk(bulk));
        }
Beispiel #4
0
        public void Regist_Bulk(IsoTileBulk _add)
        {
            if (_add == null || PrefabUtility.GetPrefabType(_add).Equals(PrefabType.Prefab))
            {
                return;
            }

            if (!_childBulkList.Exists(r => r == _add))
            {
                _childBulkList.Add(_add);
            }
        }
Beispiel #5
0
        void BulkList_Update()
        {
            BulkList_Clear();

            IsoTileBulk _bulk = _grid.gameObject.GetComponent <IsoTileBulk>();

            if (_bulk != null)
            {
                _bulks.Add(_bulk);
                _bulks.AddRange(_bulk.GetChildBulkList(true));
            }
        }
 void OnEnable()
 {
     if (bPrefab = PrefabUtility.GetPrefabType(target).Equals(PrefabType.Prefab))
     {
         return;
     }
     _bulk     = (IsoTileBulk)target;
     _SizeXZ   = serializedObject.FindProperty("SizeXZ");
     _RefTile  = serializedObject.FindProperty("_referenceTile");
     _bulkGrid = _bulk.gameObject.GetComponent <Grid>();
     refresh_Child(true);
     refresh_ConnectedBulk();
 }
Beispiel #7
0
        public IsoTileBulk NewBulk()
        {
            if (BulkPrefab == null)
            {
                Debug.LogError("IsoMap : No BulkPrefab!");
                return(null);
            }
            IsoTileBulk _newBulk = GameObject.Instantiate(BulkPrefab).GetComponent <IsoTileBulk>();

            Undo.RegisterCreatedObjectUndo(_newBulk.gameObject, "IsoTile:Create");
            _newBulk.transform.SetParent(transform, false);
            _newBulk.coordinates.Move(gGrid.Centor);
            return(_newBulk);
        }
Beispiel #8
0
        void OnEnable()
        {
            _bulk = (IsoTileBulk)target;
            if (bPrefab = PrefabHelper.IsPrefab(_bulk.gameObject))
            {
                return;
            }

            _SizeXZ   = serializedObject.FindProperty("SizeXZ");
            _RefTile  = serializedObject.FindProperty("_referenceTile");
            _bulkGrid = _bulk.gameObject.GetComponent <Grid>();
            refresh_Child(true);
            refresh_ConnectedBulk();
        }
Beispiel #9
0
        public bool Regist_Bulk(IsoTileBulk _add)
        {
            if (_add == null || PrefabHelper.IsPrefab(_add.gameObject))
            {
                return(false);
            }

            if (_childBulkList.Contains(_add))
            {
                return(false);
            }

            _childBulkList.Add(_add);
            return(true);
        }
Beispiel #10
0
        public Iso2DObject[] GetSideObjects(params Iso2DObject.Type[] _types)
        {
            if (_types == null || _types.Length == 0)
            {
                _types = new Iso2DObject.Type[] {
                    Iso2DObject.Type.Obstacle, Iso2DObject.Type.Overlay,
                    Iso2DObject.Type.Side_Union, Iso2DObject.Type.Side_X,
                    Iso2DObject.Type.Side_Y, Iso2DObject.Type.Side_Z,
                }
            }
            ;
            Iso2DObject[] results = new Iso2DObject[0];
            _attachedList.childList.ForEach(r => {
                if (r.Iso2DObj != null && ArrayUtility.Contains <Iso2DObject.Type>(_types, r.Iso2DObj._Type))
                {
                    ArrayUtility.Add <Iso2DObject>(ref results, r.Iso2DObj);
                }
            });
            return(results);
        }

        void Update()
        {
            if (!Application.isEditor || Application.isPlaying || !enabled)
            {
                return;
            }
        }

        void OnEnable()
        {
            Update_AttachmentList();
        }

        void OnTransformParentChanged()
        {
            _bulk = null;
        }

        void OnTransformChildrenChanged()
        {
            if (autoName.bPostfix_Sprite)
            {
                Rename();
            }
            Update_AttachmentList();
        }
Beispiel #11
0
        public List <IsoTileBulk> GetChildBulkList(bool bLocalBulkOnly)
        {
            List <IsoTileBulk> _bulks = new List <IsoTileBulk>();

            if (!bLocalBulkOnly || GetComponent <Grid>().IsInheritGrid)
            {
                _bulks.Add(this);
            }

            for (int i = 0; i < transform.childCount; ++i)
            {
                IsoTileBulk _bTmp = transform.GetChild(i).GetComponent <IsoTileBulk>();
                if (_bTmp != null)
                {
                    _bulks.AddRange(_bTmp.GetChildBulkList(bLocalBulkOnly));
                }
            }
            return(_bulks);
        }
Beispiel #12
0
        public IsoTileBulk NewBulk(IsoTileBulk syncWith, IEnumerable <IsoTile> tiles)
        {
            IsoTileBulk _newBulk = NewBulk();

            _newBulk.bAllowEmptyBulk = true;
            _newBulk.Clear();
            _newBulk.Sync(syncWith);
            var enumerator = tiles.GetEnumerator();

            while (enumerator.MoveNext())
            {
                var current = enumerator.Current;
                Undo.SetTransformParent(current.transform, _newBulk.transform, "IsoTile: Split Bulk");
                current.transform.parent = _newBulk.transform;
            }
            _newBulk.bAllowEmptyBulk   = false;
            Selection.activeGameObject = _newBulk.gameObject;
            EditorGUIUtility.PingObject(_newBulk.gameObject);
            return(_newBulk);
        }
Beispiel #13
0
 void OnTransformParentChanged()
 {
     _bulk = null;
 }
 void groundBulkUpdate(GameObject groundObject)
 {
     groundBulk = groundObject.GetComponentInParent <IsoTileBulk>();
 }