/// <Summary> /// Copy constructor of base parts. /// </Summary> /// <param name="baseParts">Base parts data for copying.</param> public AriadneEventParts(AriadneEventParts baseParts) { eventCategory = baseParts.eventCategory; eventTrigger = baseParts.eventTrigger; eventPos = baseParts.eventPos; startCondition = baseParts.startCondition; startFlagName = baseParts.startFlagName; startItemId = baseParts.startItemId; startNum = baseParts.startNum; comparisonOperator = baseParts.comparisonOperator; hasExecutedFlag = baseParts.hasExecutedFlag; executedFlagName = baseParts.executedFlagName; doorKeyType = baseParts.doorKeyType; destDungeon = baseParts.destDungeon; destMap = baseParts.destMap; destPos = baseParts.destPos; direction = baseParts.direction; treasureType = baseParts.treasureType; itemId = baseParts.itemId; itemNum = baseParts.itemNum; msgList = new List <string>(); foreach (string msg in baseParts.msgList) { msgList.Add(msg); } }
/// <Summary> /// Move position event process. /// </Summary> /// <param name="eventParts">Event parts data.</param> IEnumerator EventMovePosition(AriadneEventParts eventParts) { // Fade out fadeManager.FadeOut(); var waitTime = new WaitForSeconds(fadeManager.fadeTime); yield return(waitTime); // Set new position if (eventParts.destDungeon == null) { Debug.LogError("Dest dungeon is not assigned to this EventData!"); yield break; } if (eventParts.destMap == null) { Debug.LogError("Dest map is not assigned to this EventData!"); yield break; } // Send dungeon data to DungeonSetting. moveDestDungeon = eventParts.destDungeon; SendDungeonData(gameController); PlayerPosition.currentDungeonId = eventParts.destDungeon.dungeonId; PlayerPosition.currentFloorId = eventParts.destMap.floorId; PlayerPosition.playerPos = eventParts.destPos; PlayerPosition.direction = eventParts.direction; // Get new floor data DungeonSettings ds = gameController.GetComponent <DungeonSettings>(); dungeonData = ds.dungeonData; floorMapData = ds.GetCurrentFloorData(); // Add traverse data TraverseManager.AddDungeonTraverseData(PlayerPosition.currentDungeonId, PlayerPosition.currentFloorId, floorMapData); PlayerPosition.SetTraverseData(); yield return(waitTime); // Remove dungeon walls and redraw dungeon SendRedrawMessage(gameController); // Move camera SetCameraPos(); float targetAngle = CurrentDirAngle(); player.transform.eulerAngles = new Vector3(0, targetAngle, 0); SendSetNewMap(); SendSetDirtyMsg(); yield return(waitTime); // Fade in fadeManager.FadeIn(); yield return(waitTime); OnPostEvent(); }
/// <Summary> /// Show setting GUI about move position event. /// </Summary> void ShowMovePositionEventParts() { // Dest dungeon oldDungeon = editingEventParts.destDungeon; Undo.RecordObject(this, undoName); editingEventParts.destDungeon = (DungeonMasterData)EditorGUILayout.ObjectField("Dest dungeon", editingEventParts.destDungeon, typeof(DungeonMasterData), false); if (editingEventParts.destDungeon == null) { return; } DungeonFloorStruct dfs = new DungeonFloorStruct(editingEventParts.destDungeon); floorIds = dfs.floorIds; floorNames = dfs.floorNames; if (oldDungeon != editingEventParts.destDungeon) { selectedFloor = 0; editingEventParts.destMap = null; isPosSelected = false; selectedGridPos = Vector2Int.zero; editingEventParts.destPos = Vector2Int.zero; } // Dest map oldMap = editingEventParts.destMap; Undo.RecordObject(this, undoName); selectedFloor = EditorGUILayout.IntPopup("Dest map", selectedFloor, floorNames, floorIds); editingEventParts.destMap = editingEventParts.destDungeon.floorList.Find((floor) => floor.floorId == selectedFloor); if (editingEventParts.destMap != null) { isShowMap = true; } else { isShowMap = false; } if (oldMap != editingEventParts.destMap) { isPosSelected = false; selectedGridPos = Vector2Int.zero; editingEventParts.destPos = Vector2Int.zero; } // Dest position Undo.RecordObject(this, undoName); editingEventParts.destPos = EditorGUILayout.Vector2IntField("Dest position", editingEventParts.destPos); if (isPosSelected) { editingEventParts.destPos = selectedGridPos; } Undo.RecordObject(this, undoName); editingEventParts.direction = (DungeonDir)EditorGUILayout.EnumPopup("Direction of after move", editingEventParts.direction); }
/// <Summary> /// Get floor data from the DungeonSettings component. /// </Summary> void GetFloorData() { if (gameController == null) { gameController = GameObject.FindGameObjectWithTag("GameController"); } if (dungeonSettings == null) { dungeonSettings = gameController.GetComponent <DungeonSettings>(); } dungeonData = dungeonSettings.dungeonData; floorMapData = dungeonSettings.GetCurrentFloorData(); }
void GetSettings() { gameController = GameObject.FindGameObjectWithTag("GameController"); DungeonSettings ds = gameController.GetComponent <DungeonSettings>(); dungeonData = ds.dungeonData; floorMapData = ds.GetCurrentFloorData(); dungeonParts = floorMapData.dungeonParts; if (dungeonParts == null) { DungeonPartsManager.GetDefaultDungeonParts(); } player = GameObject.FindGameObjectWithTag("Player"); }
/// <Summary> /// Get settings such as dungeon data from DungeonSettings class. /// </Summary> protected void GetSettings() { gameController = GameObject.FindGameObjectWithTag("GameController"); DungeonSettings ds = gameController.GetComponent <DungeonSettings>(); dungeonData = ds.dungeonData; currentFloorMapData = ds.GetCurrentFloorData(); dungeonParts = currentFloorMapData.dungeonParts; if (dungeonParts == null) { DungeonPartsManager.GetDefaultDungeonParts(); } isDrawOutsideWall = ds.isDrawOutsideWall; outsideWallSize = ds.outsideWallSize; }
/// <Summary> /// Constructor of DungeonFloorStruct. /// </Summary> /// <param name="dungeonData">Dungeon data to get floor list.</param> public DungeonFloorStruct(DungeonMasterData dungeonData) { List <int> floorIdList = new List <int>(); List <string> floorNameList = new List <string>(); if (dungeonData != null) { foreach (FloorMapMasterData floor in dungeonData.floorList) { floorIdList.Add(floor.floorId); floorNameList.Add(floor.name); } } floorIds = floorIdList.ToArray(); floorNames = floorNameList.ToArray(); }
/// <Summary> /// Set a new dungeon data to DungeonSetting component. /// </Summary> /// <param name="dungeonData">New dungeon data.</param> public void OnSetDungeon(DungeonMasterData dungeonData) { this.dungeonData = dungeonData; }