public void ShowProperty(MapEditorFeatureController feature) { selectedFeature = feature; this.gameObject.SetActive(true); inputAngle.text = feature.GetRotation().ToString(); inputRadius.text = feature.GetRadius().ToString(); }
private List <EditorMapFeatureData> RegenerateMapFeatureData() { int count = mapFeatureParent.childCount; List <EditorMapFeatureData> mapFeatures = new List <EditorMapFeatureData>(); for (int i = 0; i < count; i++) { MapEditorFeatureController controller = mapFeatureParent.GetChild(i).gameObject.GetComponent <MapEditorFeatureController>(); mapFeatures.Add(controller.GenerateData()); } return(mapFeatures); }
void GenerateMapFeature(List <EditorMapFeatureData> features) { for (int i = 0; i < features.Count; i++) { EditorMapFeatureData referenceData = features[i]; Object prefab = AssetManager.Instance.GetPrefabByKeyword(referenceData.assetCode); GameObject go = Instantiate(prefab) as GameObject; go.transform.SetParent(mapFeatureParent); MapEditorFeatureController mfController = go.AddComponent <MapEditorFeatureController>(); mfController.Init(referenceData); } }
public void OnPointerClick(PointerEventData eventData) { if (ToolboxManager.Instance.selectedTileType == ToolBoxTileType.MapFeature) { Vector3 pressPosition = eventData.pointerPressRaycast.worldPosition; ToolboxMapFeatureTemplate template = (ToolboxMapFeatureTemplate)ToolboxManager.Instance.tileTemplate; Object prefab = AssetManager.Instance.GetPrefabByKeyword(template.assetCode); GameObject go = Instantiate(prefab) as GameObject; go.transform.SetParent(EditorTileManager.Instance.mapFeatureParent); MapEditorFeatureController featureController = go.AddComponent <MapEditorFeatureController>(); EditorMapFeatureData data = new EditorMapFeatureData(); data.assetCode = template.assetCode; data.tileOptionType = (int)TileOptionType.MapFeature; data.mapFeatureType = (int)template.mapFeatureType; data.mapXPos = pressPosition.x; data.mapYPos = pressPosition.y; data.radius = template.radius; featureController.Init(data); Debug.Log("Spawn A Map Feature " + data.assetCode); } }