protected override void Execute() { Vector2 worldPosition = Camera.main.ScreenToWorldPoint(screenPosition); GenerateableLevelObjectNode generateableLevelObjectNode = SelectedLevelObjectNodeStatus.LevelObjectNode; GameObject levelObjectGameObject = LevelObjectHelper.InstantiateLevelObject(generateableLevelObjectNode, worldPosition, context); ILevelObject levelObject = levelObjectGameObject.GetComponent <ILevelObject>(); levelObject.Select(); }
private void SpawnLevelObjects(List <LevelObjectSaveData> levelObjectsSaveData) { foreach (LevelObjectSaveData levelObjectSaveData in levelObjectsSaveData) { LevelObjectType levelObjectType = levelObjectSaveData.LevelObjectType; GenerateableLevelObjectNode levelEditorLevelObjectEditorNode = GenerateableLevelObjectLibrary.GetNode(levelObjectType); Vector2 position = levelObjectSaveData.Position; GameObject levelObject = LevelObjectHelper.InstantiateLevelObject(levelEditorLevelObjectEditorNode, position, context); levelObject.transform.localScale = levelObjectSaveData.Size; levelObject.transform.rotation = levelObjectSaveData.Rotation; } }