void Awake() { IsoResources.Load("Assets/Config/Resources.cfg"); IsoCamera.Init(); IsoMap.Load("Assets/Maps/TestMap1.map"); }
static void AttachmentField <T>(Object owner, T attachment) where T : class, IGameObject, IAttachment, IFloatValue, new() { const int cellSize = 44; const int fudgeWidth = 175; const int border = 2; Transform _transform = attachment.gameObject.transform; SpriteRenderer _sprr = attachment.gameObject.GetComponent <SpriteRenderer>(); float _fDepthFudge = attachment.FloatValue; int IndentLevel = attachment.IndentLevel; Color borderColor = Selection.activeObject == _transform.gameObject ? CustomEditorGUI.Color_LightYellow : Color.gray; Rect rect = EditorGUI.IndentedRect(EditorGUILayout.GetControlRect(GUILayout.Height(cellSize + border * 2))); Rect rect_inside = new Rect(rect.xMin + border, rect.yMin + border, rect.width - border * 2, rect.height - border * 2); Rect rect_preview = new Rect(rect_inside.xMin, rect_inside.yMin, cellSize, rect_inside.height); Rect rect_info_name = new Rect(rect_preview.xMax, rect_inside.yMin, rect_inside.width - cellSize - fudgeWidth, rect_inside.height * 0.5f); Rect rect_Fudge = new Rect(rect_info_name.xMax, rect_inside.yMin, fudgeWidth, rect_inside.height * 0.5f - border); Rect rect_info_Sub = new Rect(rect_info_name.xMin, rect_info_name.yMin + cellSize * 0.5f, rect_info_name.width, rect_inside.height - rect_info_name.height); Rect rect_select_reset = new Rect(rect_inside.xMax - cellSize * 3.1f, rect_info_Sub.yMin, cellSize * 1.5f, rect_info_Sub.height); Rect rect_select_go = new Rect(rect_inside.xMax - cellSize * 1.5f, rect_info_Sub.yMin, cellSize * 1.5f, rect_info_Sub.height); CustomEditorGUI.DrawBordereddRect(rect, borderColor, rect_inside, Color.clear); if (_sprr != null) { CustomEditorGUI.DrawSprite(rect_preview, _sprr.sprite, Color.white, false, false); } else { EditorGUI.LabelField(rect_preview, "Trans\nform\nNode"); } int iLv = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; EditorGUI.LabelField(rect_info_name, _transform.name, EditorStyles.boldLabel); float _fNewDepthFudge = CustomEditorGUI.FloatSlider(rect_Fudge, "Depth", _fDepthFudge, -1f, 1f); // 서브 인포 출력 //using (new EditorGUILayout.HorizontalScope()) { float _fMinSize = Mathf.Min(rect_info_Sub.width, rect_info_Sub.height); SpriteRenderer[] _sprrList = _transform.GetComponentsInChildren <SpriteRenderer>(); for (int i = 0; i < _sprrList.Length; ++i) { if (_sprrList[i].sprite != null && _sprrList[i] != _sprr) { Rect _rt = EditorGUI.IndentedRect(rect_info_Sub); _rt.width = _rt.height = _fMinSize; rect_info_Sub.xMin += _fMinSize; CustomEditorGUI.DrawSprite(_rt, _sprrList[i].sprite, _sprrList[i].color, true, true); } } } using (new GUIBackgroundColorScope(Util.CustomEditorGUI.Color_LightMagenta)) { if (GUI.Button(rect_select_reset, "Depth 0")) { _fNewDepthFudge = 0; } } using (new GUIBackgroundColorScope(Util.CustomEditorGUI.Color_LightYellow)) { if (GUI.Button(rect_select_go, "Select")) { Selection.activeGameObject = _transform.gameObject; } } if (_fNewDepthFudge != _fDepthFudge) { Undo.RecordObject(_transform, "Transform : LocalOffset"); _transform.position = _transform.position - IsoMap.vDepthFudge(_fDepthFudge) + IsoMap.vDepthFudge(_fNewDepthFudge); Undo.RecordObject(owner, "DepthFudge changed"); attachment.FloatValue = _fNewDepthFudge; } EditorGUI.indentLevel = iLv; }
protected internal virtual void UponPlaced(IsoMap map) { DrawPosition = map.GetTileDrawPosition(Position).ToVector2(); }
protected internal virtual void UponRemoved(IsoMap map) { // Should this also call the relevant UponRemoved method on all the components? }
public AStarUserContext(IsoMap map, TileEntity entity, Dictionary <TileEntity, bool> whiteList = null) { this.map = map; this.entity = entity; this.whiteList = whiteList; }