public Iso2DObject GetSideObject(Iso2DObject.Type _type) { if (AttachedList.childList.Exists(r => r.AttachedObj._Type == _type)) { return(AttachedList.childList.Find(r => r.AttachedObj._Type == _type).AttachedObj); } return(null); }
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(); }
public GameObject GetSidePrefab(Iso2DObject.Type _type) { switch (_type) { case Iso2DObject.Type.Side_Union: return(Side_Union_Prefab); case Iso2DObject.Type.Side_X: return(Side_X_Prefab); case Iso2DObject.Type.Side_Y: return(Side_Y_Prefab); case Iso2DObject.Type.Side_Z: return(Side_Z_Prefab); } return(null); }
public static GameObject GetSidePrefab(Iso2DObject.Type _type) { switch (_type) { case Iso2DObject.Type.Side_Union: return(Prefab_Side_Union); case Iso2DObject.Type.Side_X: return(Prefab_Side_X); case Iso2DObject.Type.Side_Y: return(Prefab_Side_Y); case Iso2DObject.Type.Side_Z: return(Prefab_Side_Z); } return(null); }
public void Toggle_Side(bool _bToggle, Iso2DObject.Type _toggleType) { Iso2DObject _obj = GetSideObject(_toggleType); if (_bToggle) { if (_obj == null) { Add_SideObject(IsoMap.GetSidePrefab(_toggleType), "Created : " + _toggleType + " Object"); } } else { if (_obj != null) { _obj.DestoryGameObject(true, true); Update_AttachmentList(); } } }
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, } } ; List <Iso2DObject> results = new List <Iso2DObject>(); AttachedList.childList.ForEach(r => { if (r.AttachedObj != null && _types.Contains(r.AttachedObj._Type)) { results.Add(r.AttachedObj); } }); return(results.ToArray()); }
public static Rect Divid_TileSide(this Rect rt, Iso2DObject.Type _side) { float _fDivision = IsoMap.fMagicValue; float[] _x_List = new float[] { 1 / 2f, 1 / 2f }; float[] _y_List_U = new float[] { (_fDivision + 1) / (_fDivision + 2) }; float[] _y_List_D = new float[] { _fDivision / (_fDivision + 2), 2 / (_fDivision + 2) }; switch (_side) { case Iso2DObject.Type.Side_X: return(rt.Division(_x_List, _y_List_U)[0]); case Iso2DObject.Type.Side_Y: return(rt.Division(null, _y_List_D)[1]); case Iso2DObject.Type.Side_Z: return(rt.Division(_x_List, _y_List_U)[1]); } return(rt); }
Iso2DObject Side_Field(Rect _Rect, Iso2DObject.Type _sideType, Color _color, GameObject _prefab) { Iso2DObject _obj = _tile_Inspector.GetSideObject(_sideType); bool _bToggle = _obj != null; _Rect.height = EditorGUIUtility.singleLineHeight; EditorGUI.BeginChangeCheck(); _bToggle = EditorGUI.ToggleLeft(_Rect, _sideType.ToString(), _bToggle); if (EditorGUI.EndChangeCheck()) { for (int i = 0; i < Selection.gameObjects.Length; ++i) { if (Selection.gameObjects[i] == null) { continue; } IsoTile _t = Selection.gameObjects[i].GetComponent <IsoTile>(); if (_t != null && !_t.IsUnionCube()) { _t.Toggle_Side(_bToggle, _sideType); } } } List <Iso2DObject> _lookupList = Iso2DObject.GetSideListOfTileSelection(_sideType); if (_bToggle && _lookupList.Count > 0) { if (_obj == null) { _obj = _tile_Scene.GetSideObject(_sideType); } _Rect.y += _Rect.height; CustomEditorGUI.Undo_Iso2DSpriteField(_Rect, _obj.sprr.sprite, _lookupList, _color); } return(_obj); }
public static void DrawSideSprite(Rect _FullRect, Sprite _sprite, Color _color, Iso2DObject.Type _side, bool _bSquare, bool _bSimpleDraw) { // Rect _rt = _sprite.textureRectOffset.Equals(Vector2.zero) // ? _FullRect.Divid_TileSide(_side) : _FullRect; Rect _rt = _FullRect.Divid_TileSide(_side); Util.CustomEditorGUI.DrawSprite(_rt, _sprite, _color, _bSquare, _bSimpleDraw); }