public override void tick(ScreenWorld screen) { if (InputHandler.TAB.wasTyped()) { isHidden = !isHidden; } }
public MainViewModel(WorldConfiguration conf) { World = new ScreenWorld(conf); foreach (var evt in Events) { World.AddElementToWorld(evt); } World.UpdateRangeOfWorld(50.0); }
public override void tick(ScreenWorld world) { }
/** * Shows the GUI. */ public void ShowGUI() { EditorGUILayout.LabelField ("Save game settings", EditorStyles.boldLabel); if (saveFileName == "") { saveFileName = SaveSystem.SetProjectName (); } maxSaves = EditorGUILayout.IntField ("Max. number of saves:", maxSaves); saveFileName = EditorGUILayout.TextField ("Save filename:", saveFileName); if (saveFileName != "") { if (saveFileName.Contains (" ")) { EditorGUILayout.HelpBox ("The save filename cannot contain 'space' characters - please remove them to prevent file-handling issues.", MessageType.Warning); } else { #if !(UNITY_WP8 || UNITY_WINRT) string newSaveFileName = System.Text.RegularExpressions.Regex.Replace (saveFileName, "[^\\w\\._]", ""); if (saveFileName != newSaveFileName) { EditorGUILayout.HelpBox ("The save filename contains special characters - please remove them to prevent file-handling issues.", MessageType.Warning); } #endif } } useProfiles = EditorGUILayout.ToggleLeft ("Enable save game profiles?", useProfiles); #if !UNITY_WEBPLAYER && !UNITY_ANDROID && !UNITY_WINRT && !UNITY_WII saveTimeDisplay = (SaveTimeDisplay) EditorGUILayout.EnumPopup ("Time display:", saveTimeDisplay); takeSaveScreenshots = EditorGUILayout.ToggleLeft ("Take screenshot when saving?", takeSaveScreenshots); orderSavesByUpdateTime = EditorGUILayout.ToggleLeft ("Order save lists by update time?", orderSavesByUpdateTime); #else EditorGUILayout.HelpBox ("Save-game screenshots are disabled for WebPlayer, Windows Store and Android platforms.", MessageType.Info); takeSaveScreenshots = false; #endif if (GUILayout.Button ("Auto-add save components to GameObjects")) { AssignSaveScripts (); } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Cutscene settings:", EditorStyles.boldLabel); actionListOnStart = ActionListAssetMenu.AssetGUI ("ActionList on start game:", actionListOnStart); blackOutWhenSkipping = EditorGUILayout.Toggle ("Black out when skipping?", blackOutWhenSkipping); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Character settings:", EditorStyles.boldLabel); CreatePlayersGUI (); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Interface settings", EditorStyles.boldLabel); movementMethod = (MovementMethod) EditorGUILayout.EnumPopup ("Movement method:", movementMethod); inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod); interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod); //if (inputMethod != InputMethod.TouchScreen) if (CanUseCursor ()) { if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction) { selectInteractions = (SelectInteractions) EditorGUILayout.EnumPopup ("Select Interactions by:", selectInteractions); if (selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot) { seeInteractions = (SeeInteractions) EditorGUILayout.EnumPopup ("See Interactions with:", seeInteractions); if (seeInteractions == SeeInteractions.ClickOnHotspot) { stopPlayerOnClickHotspot = EditorGUILayout.ToggleLeft ("Stop player moving when click Hotspot?", stopPlayerOnClickHotspot); } } if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot) { autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Auto-cycle after an Interaction?", autoCycleWhenInteract); } if (SelectInteractionMethod () == SelectInteractions.ClickingMenu) { clickUpInteractions = EditorGUILayout.ToggleLeft ("Trigger interaction by releasing click?", clickUpInteractions); cancelInteractions = (CancelInteractions) EditorGUILayout.EnumPopup ("Close interactions with:", cancelInteractions); } else { cancelInteractions = CancelInteractions.CursorLeavesMenu; } } } if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Reset cursor after an Interaction?", autoCycleWhenInteract); } if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen) { // First person dragging only works if cursor is unlocked lockCursorOnStart = false; } else { lockCursorOnStart = EditorGUILayout.ToggleLeft ("Lock cursor in screen's centre when game begins?", lockCursorOnStart); hideLockedCursor = EditorGUILayout.ToggleLeft ("Hide cursor when locked in screen's centre?", hideLockedCursor); if (movementMethod == MovementMethod.FirstPerson) { onlyInteractWhenCursorUnlocked = EditorGUILayout.ToggleLeft ("Disallow Interactions if cursor is locked?", onlyInteractWhenCursorUnlocked); } } if (IsInFirstPerson ()) { disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft ("Disable free-aim when moving Draggables and PickUps?", disableFreeAimWhenDragging); if (movementMethod == MovementMethod.FirstPerson) { useFPCamDuringConversations = EditorGUILayout.ToggleLeft ("Run Conversations in first-person?", useFPCamDuringConversations); } } if (inputMethod != InputMethod.TouchScreen) { runConversationsWithKeys = EditorGUILayout.ToggleLeft ("Dialogue options can be selected with number keys?", runConversationsWithKeys); } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Inventory settings", EditorStyles.boldLabel); if (interactionMethod != AC_InteractionMethod.ContextSensitive) { inventoryInteractions = (InventoryInteractions) EditorGUILayout.EnumPopup ("Inventory interactions:", inventoryInteractions); if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction) { if (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot) { cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Include Inventory items in Hotspot Interaction cycles?", cycleInventoryCursors); } else { cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Include Inventory items in Hotspot Interaction menus?", cycleInventoryCursors); } } if (inventoryInteractions == InventoryInteractions.Multiple && CanSelectItems (false)) { selectInvWithUnhandled = EditorGUILayout.ToggleLeft ("Select item if Interaction is unhandled?", selectInvWithUnhandled); if (selectInvWithUnhandled) { CursorManager cursorManager = AdvGame.GetReferences ().cursorManager; if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0) { selectInvWithIconID = GetIconID ("Select with unhandled:", selectInvWithIconID, cursorManager); } else { EditorGUILayout.HelpBox ("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info); } } giveInvWithUnhandled = EditorGUILayout.ToggleLeft ("Give item if Interaction is unhandled?", giveInvWithUnhandled); if (giveInvWithUnhandled) { CursorManager cursorManager = AdvGame.GetReferences ().cursorManager; if (cursorManager != null && cursorManager.cursorIcons != null && cursorManager.cursorIcons.Count > 0) { giveInvWithIconID = GetIconID ("Give with unhandled:", giveInvWithIconID, cursorManager); } else { EditorGUILayout.HelpBox ("No Interaction cursors defined - please do so in the Cursor Manager.", MessageType.Info); } } } } if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && selectInteractions != SelectInteractions.ClickingMenu && inventoryInteractions == InventoryInteractions.Multiple) {} else { reverseInventoryCombinations = EditorGUILayout.ToggleLeft ("Combine interactions work in reverse?", reverseInventoryCombinations); } if (CanSelectItems (false)) { inventoryDragDrop = EditorGUILayout.ToggleLeft ("Drag and drop Inventory interface?", inventoryDragDrop); if (!inventoryDragDrop) { if (interactionMethod == AC_InteractionMethod.ContextSensitive || inventoryInteractions == InventoryInteractions.Single) { rightClickInventory = (RightClickInventory) EditorGUILayout.EnumPopup ("Right-click active item:", rightClickInventory); } } else { dragDropThreshold = EditorGUILayout.Slider ("Minimum drag distance:", dragDropThreshold, 0f, 20f); if (inventoryInteractions == AC.InventoryInteractions.Single) { if (dragDropThreshold == 0f) { inventoryDropLook = EditorGUILayout.ToggleLeft ("Can drop an Item onto itself to Examine it?", inventoryDropLook); } else { inventoryDropLook = EditorGUILayout.ToggleLeft ("Clicking an Item without dragging Examines it?", inventoryDropLook); } } } } if (CanSelectItems (false) && !inventoryDragDrop) { inventoryDisableLeft = EditorGUILayout.ToggleLeft ("Left-click deselects active item?", inventoryDisableLeft); if (movementMethod == MovementMethod.PointAndClick && !inventoryDisableLeft) { canMoveWhenActive = EditorGUILayout.ToggleLeft ("Can move player if an Item is active?", canMoveWhenActive); } } inventoryActiveEffect = (InventoryActiveEffect) EditorGUILayout.EnumPopup ("Active cursor FX:", inventoryActiveEffect); if (inventoryActiveEffect == InventoryActiveEffect.Pulse) { inventoryPulseSpeed = EditorGUILayout.Slider ("Active FX pulse speed:", inventoryPulseSpeed, 0.5f, 2f); } activeWhenUnhandled = EditorGUILayout.ToggleLeft ("Show Active FX when an Interaction is unhandled?", activeWhenUnhandled); canReorderItems = EditorGUILayout.ToggleLeft ("Items can be re-ordered in Menu?", canReorderItems); selectInventoryDisplay = (SelectInventoryDisplay) EditorGUILayout.EnumPopup ("Seleted item's display:", selectInventoryDisplay); activeWhenHover = EditorGUILayout.ToggleLeft ("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover); EditorGUILayout.Space (); if (assumeInputsDefined) { EditorGUILayout.LabelField ("Required inputs:", EditorStyles.boldLabel); } else { EditorGUILayout.LabelField ("Available inputs:", EditorStyles.boldLabel); } EditorGUILayout.HelpBox ("The following inputs are available for the chosen interface settings:" + GetInputList (), MessageType.Info); assumeInputsDefined = EditorGUILayout.ToggleLeft ("Assume inputs are defined?", assumeInputsDefined); if (assumeInputsDefined) { EditorGUILayout.HelpBox ("Try/catch statements used when checking for input will be bypassed - this results in better performance, but all available inputs must be defined. Delegates in PlayerInput.cs will also be ignored", MessageType.Warning); } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Movement settings", EditorStyles.boldLabel); if ((inputMethod == InputMethod.TouchScreen && movementMethod != MovementMethod.PointAndClick) || movementMethod == MovementMethod.Drag) { dragWalkThreshold = EditorGUILayout.FloatField ("Walk threshold:", dragWalkThreshold); dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold); if (inputMethod == InputMethod.TouchScreen && movementMethod == MovementMethod.FirstPerson) { freeAimTouchSpeed = EditorGUILayout.FloatField ("Freelook speed:", freeAimTouchSpeed); } drawDragLine = EditorGUILayout.Toggle ("Draw drag line?", drawDragLine); if (drawDragLine) { dragLineWidth = EditorGUILayout.FloatField ("Drag line width:", dragLineWidth); dragLineColor = EditorGUILayout.ColorField ("Drag line colour:", dragLineColor); } } else if (movementMethod == MovementMethod.Direct) { magnitudeAffectsDirect = EditorGUILayout.ToggleLeft ("Input magnitude affects speed?", magnitudeAffectsDirect); directTurnsInstantly = EditorGUILayout.ToggleLeft ("Turn instantly when under player control?", directTurnsInstantly); directMovementType = (DirectMovementType) EditorGUILayout.EnumPopup ("Direct-movement type:", directMovementType); if (directMovementType == DirectMovementType.RelativeToCamera) { limitDirectMovement = (LimitDirectMovement) EditorGUILayout.EnumPopup ("Movement limitation:", limitDirectMovement); if (cameraPerspective == CameraPerspective.ThreeD) { directMovementPerspective = EditorGUILayout.ToggleLeft ("Account for player's position on screen?", directMovementPerspective); } } } else if (movementMethod == MovementMethod.PointAndClick) { clickPrefab = (Transform) EditorGUILayout.ObjectField ("Click marker:", clickPrefab, typeof (Transform), false); walkableClickRange = EditorGUILayout.Slider ("NavMesh search %:", walkableClickRange, 0f, 1f); if (walkableClickRange > 0f) { navMeshSearchDirection = (NavMeshSearchDirection) EditorGUILayout.EnumPopup ("NavMesh search direction:", navMeshSearchDirection); } doubleClickMovement = EditorGUILayout.Toggle ("Double-click to move?", doubleClickMovement); } else if (movementMethod == MovementMethod.FirstPerson) { directMovementType = (DirectMovementType) EditorGUILayout.EnumPopup ("Turning type:", directMovementType); } if (movementMethod == MovementMethod.StraightToCursor) { dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold); singleTapStraight = EditorGUILayout.ToggleLeft ("Single-clicking also moves player?", singleTapStraight); if (singleTapStraight) { singleTapStraightPathfind = EditorGUILayout.ToggleLeft ("Pathfind when single-clicking?", singleTapStraightPathfind); } } if ((movementMethod == MovementMethod.Direct || movementMethod == MovementMethod.FirstPerson) && inputMethod != InputMethod.TouchScreen) { jumpSpeed = EditorGUILayout.Slider ("Jump speed:", jumpSpeed, 1f, 10f); } destinationAccuracy = EditorGUILayout.Slider ("Destination accuracy:", destinationAccuracy, 0f, 1f); if (destinationAccuracy == 1f) { experimentalAccuracy = EditorGUILayout.ToggleLeft ("Attempt to be super-accurate? (Experimental)", experimentalAccuracy); } pathfindUpdateFrequency = EditorGUILayout.Slider ("Pathfinding update time (s)", pathfindUpdateFrequency, 0f, 5f); if (inputMethod == InputMethod.TouchScreen) { EditorGUILayout.Space (); EditorGUILayout.LabelField ("Touch Screen settings", EditorStyles.boldLabel); if (movementMethod != MovementMethod.FirstPerson) { offsetTouchCursor = EditorGUILayout.Toggle ("Drag cursor with touch?", offsetTouchCursor); } else { firstPersonTouchScreen = (FirstPersonTouchScreen) EditorGUILayout.EnumPopup ("First person movement:", firstPersonTouchScreen); } doubleTapHotspots = EditorGUILayout.Toggle ("Double-tap Hotspots?", doubleTapHotspots); } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Camera settings", EditorStyles.boldLabel); cameraPerspective_int = (int) cameraPerspective; cameraPerspective_int = EditorGUILayout.Popup ("Camera perspective:", cameraPerspective_int, cameraPerspective_list); cameraPerspective = (CameraPerspective) cameraPerspective_int; if (movementMethod == MovementMethod.FirstPerson) { cameraPerspective = CameraPerspective.ThreeD; } if (cameraPerspective == CameraPerspective.TwoD) { movingTurning = (MovingTurning) EditorGUILayout.EnumPopup ("Moving and turning:", movingTurning); if (movingTurning == MovingTurning.TopDown || movingTurning == MovingTurning.Unity2D) { verticalReductionFactor = EditorGUILayout.Slider ("Vertical movement factor:", verticalReductionFactor, 0.1f, 1f); } } forceAspectRatio = EditorGUILayout.Toggle ("Force aspect ratio?", forceAspectRatio); if (forceAspectRatio) { wantedAspectRatio = EditorGUILayout.FloatField ("Aspect ratio:", wantedAspectRatio); #if UNITY_IPHONE landscapeModeOnly = EditorGUILayout.Toggle ("Landscape-mode only?", landscapeModeOnly); #endif } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Hotspot settings", EditorStyles.boldLabel); hotspotDetection = (HotspotDetection) EditorGUILayout.EnumPopup ("Hotspot detection method:", hotspotDetection); if (hotspotDetection == HotspotDetection.PlayerVicinity && (movementMethod == MovementMethod.Direct || IsInFirstPerson ())) { hotspotsInVicinity = (HotspotsInVicinity) EditorGUILayout.EnumPopup ("Hotspots in vicinity:", hotspotsInVicinity); } else if (hotspotDetection == HotspotDetection.MouseOver) { scaleHighlightWithMouseProximity = EditorGUILayout.ToggleLeft ("Highlight Hotspots based on cursor proximity?", scaleHighlightWithMouseProximity); if (scaleHighlightWithMouseProximity) { highlightProximityFactor = EditorGUILayout.FloatField ("Cursor proximity factor:", highlightProximityFactor); } } if (cameraPerspective != CameraPerspective.TwoD) { playerFacesHotspots = EditorGUILayout.ToggleLeft ("Player turns head to active Hotspot?", playerFacesHotspots); } hotspotIconDisplay = (HotspotIconDisplay) EditorGUILayout.EnumPopup ("Display Hotspot icons:", hotspotIconDisplay); if (hotspotIconDisplay != HotspotIconDisplay.Never) { if (cameraPerspective != CameraPerspective.TwoD) { hotspotDrawing = (ScreenWorld) EditorGUILayout.EnumPopup ("Draw icons in:", hotspotDrawing); occludeIcons = EditorGUILayout.ToggleLeft ("Don't show behind Colliders?", occludeIcons); } hotspotIcon = (HotspotIcon) EditorGUILayout.EnumPopup ("Hotspot icon type:", hotspotIcon); if (hotspotIcon == HotspotIcon.Texture) { hotspotIconTexture = (Texture2D) EditorGUILayout.ObjectField ("Hotspot icon texture:", hotspotIconTexture, typeof (Texture2D), false); } hotspotIconSize = EditorGUILayout.FloatField ("Hotspot icon size:", hotspotIconSize); if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction && selectInteractions != SelectInteractions.CyclingCursorAndClickingHotspot && hotspotIconDisplay != HotspotIconDisplay.OnlyWhenFlashing) { hideIconUnderInteractionMenu = EditorGUILayout.ToggleLeft ("Hide when Interaction Menus are visible?", hideIconUnderInteractionMenu); } } #if UNITY_5 EditorGUILayout.Space (); EditorGUILayout.LabelField ("Audio settings", EditorStyles.boldLabel); volumeControl = (VolumeControl) EditorGUILayout.EnumPopup ("Volume controlled by:", volumeControl); if (volumeControl == VolumeControl.AudioMixerGroups) { musicMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("Music mixer:", musicMixerGroup, typeof (AudioMixerGroup), false); sfxMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("SFX mixer:", sfxMixerGroup, typeof (AudioMixerGroup), false); speechMixerGroup = (AudioMixerGroup) EditorGUILayout.ObjectField ("Speech mixer:", speechMixerGroup, typeof (AudioMixerGroup), false); musicAttentuationParameter = EditorGUILayout.TextField ("Music atten. parameter:", musicAttentuationParameter); sfxAttentuationParameter = EditorGUILayout.TextField ("SFX atten. parameter:", sfxAttentuationParameter); speechAttentuationParameter = EditorGUILayout.TextField ("Speech atten. parameter:", speechAttentuationParameter); } #endif EditorGUILayout.Space (); EditorGUILayout.LabelField ("Raycast settings", EditorStyles.boldLabel); navMeshRaycastLength = EditorGUILayout.FloatField ("NavMesh ray length:", navMeshRaycastLength); hotspotRaycastLength = EditorGUILayout.FloatField ("Hotspot ray length:", hotspotRaycastLength); moveableRaycastLength = EditorGUILayout.FloatField ("Moveable ray length:", moveableRaycastLength); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Layer names", EditorStyles.boldLabel); hotspotLayer = EditorGUILayout.TextField ("Hotspot:", hotspotLayer); navMeshLayer = EditorGUILayout.TextField ("Nav mesh:", navMeshLayer); if (cameraPerspective == CameraPerspective.TwoPointFiveD) { backgroundImageLayer = EditorGUILayout.TextField ("Background image:", backgroundImageLayer); } deactivatedLayer = EditorGUILayout.TextField ("Deactivated:", deactivatedLayer); EditorGUILayout.Space (); EditorGUILayout.LabelField ("Scene loading", EditorStyles.boldLabel); reloadSceneWhenLoading = EditorGUILayout.ToggleLeft ("Always reload scene when loading a save file?", reloadSceneWhenLoading); useAsyncLoading = EditorGUILayout.ToggleLeft ("Load scenes asynchronously?", useAsyncLoading); useLoadingScreen = EditorGUILayout.ToggleLeft ("Use loading screen?", useLoadingScreen); if (useLoadingScreen) { loadingSceneIs = (ChooseSceneBy) EditorGUILayout.EnumPopup ("Choose loading scene by:", loadingSceneIs); if (loadingSceneIs == ChooseSceneBy.Name) { loadingSceneName = EditorGUILayout.TextField ("Loading scene name:", loadingSceneName); } else { loadingScene = EditorGUILayout.IntField ("Loading screen scene:", loadingScene); } if (useAsyncLoading) { loadingDelay = EditorGUILayout.Slider ("Delay before and after (s):", loadingDelay, 0f, 1f); } } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Options data", EditorStyles.boldLabel); optionsData = Options.LoadPrefsFromID (0, false, true); if (optionsData == null) { ACDebug.Log ("Saved new prefs"); Options.SaveDefaultPrefs (optionsData); } defaultSpeechVolume = optionsData.speechVolume = EditorGUILayout.Slider ("Speech volume:", optionsData.speechVolume, 0f, 1f); defaultMusicVolume = optionsData.musicVolume = EditorGUILayout.Slider ("Music volume:", optionsData.musicVolume, 0f, 1f); defaultSfxVolume = optionsData.sfxVolume = EditorGUILayout.Slider ("SFX volume:", optionsData.sfxVolume, 0f, 1f); defaultShowSubtitles = optionsData.showSubtitles = EditorGUILayout.Toggle ("Show subtitles?", optionsData.showSubtitles); defaultLanguage = optionsData.language = EditorGUILayout.IntField ("Language:", optionsData.language); Options.SaveDefaultPrefs (optionsData); if (GUILayout.Button ("Reset options data")) { optionsData = new OptionsData (); optionsData.language = 0; optionsData.speechVolume = 1f; optionsData.musicVolume = 0.6f; optionsData.sfxVolume = 0.9f; optionsData.showSubtitles = false; Options.SavePrefsToID (0, optionsData, true); } EditorGUILayout.Space (); EditorGUILayout.LabelField ("Debug settings", EditorStyles.boldLabel); showActiveActionLists = EditorGUILayout.ToggleLeft ("List active ActionLists in Game window?", showActiveActionLists); showHierarchyIcons = EditorGUILayout.ToggleLeft ("Show icons in Hierarchy window?", showHierarchyIcons); showDebugLogs = (ShowDebugLogs) EditorGUILayout.EnumPopup ("Show logs in Console:", showDebugLogs); if (GUI.changed) { EditorUtility.SetDirty (this); } }