예제 #1
0
    /// <summary>
    /// The main method for moving! Walking will not work if the default value (null) for destinationPathTile is used, as the path is supplied with the said variable.
    /// </summary>
    /// <param name="destinationTile"></param>
    /// <param name="method"></param>
    /// <param name="destinationPathTile"></param>
    /// <returns></returns>

    public bool MoveToTile(Tile destinationTile, MovementMethod method, PathTile destinationPathTile = null)
    {
        switch (method)
        {
        case MovementMethod.NotSpecified:
            Debug.Log("Movement method not selected!");
            break;

        case MovementMethod.Teleport:
            Teleport(destinationTile);
            break;

        case MovementMethod.Walk:
            if (destinationTile.myType == Tile.BlockType.BlockyBlock || destinationTile.CharCurrentlyOnTile != null)
            {
                return(false);
            }
            if (destinationPathTile != null && destinationPathTile._tile == destinationTile)
            {
                List <PathTile> route = LinkListAndOrder(destinationPathTile);
                StartCoroutine("Walk", route);
            }

            break;

        default:
            Debug.Log("Error with movement method selection!");      //Not yet implemented?
            break;
        }
        CurrentTile = destinationTile;
        return(true);
    }
예제 #2
0
    void HandlePhysicsMovement(Rigidbody2D rigidbody, MovementMethod moveMethod)
    {
        // Set the velocity (or add the force) on the axes the howToApply object dictates


        Vector2 toApply = rigidbody.velocity;

        if (howToApply.applyX)
        {
            toApply.x = howToApply.movementVector.x;
        }
        if (howToApply.applyY)
        {
            toApply.y = howToApply.movementVector.y;
        }

        toApply *= localTimeScale;

        switch (moveMethod)
        {
        case MovementMethod.setVelocity:
            rigidbody.velocity = toApply;
            break;

        case MovementMethod.addForce:
            rigidbody.AddForce(toApply);
            break;

        default:
            string errMessage = "Movement method {0} not accounted for in handling physics movement.";
            throw new System.ArgumentException(errMessage);
        }
    }
        override public void ShowGUI()
        {
            changeMovementMethod = EditorGUILayout.BeginToggleGroup("Change movement method?", changeMovementMethod);
            newMovementMethod    = (MovementMethod)EditorGUILayout.EnumPopup("Movement method:", newMovementMethod);
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.Space();

            cursorLock      = (LockType)EditorGUILayout.EnumPopup("Cursor:", cursorLock);
            inputLock       = (LockType)EditorGUILayout.EnumPopup("Input:", inputLock);
            interactionLock = (LockType)EditorGUILayout.EnumPopup("Interactions:", interactionLock);
            menuLock        = (LockType)EditorGUILayout.EnumPopup("Menus:", menuLock);
            movementLock    = (LockType)EditorGUILayout.EnumPopup("Movement:", movementLock);
            cameraLock      = (LockType)EditorGUILayout.EnumPopup("Camera:", cameraLock);
            triggerLock     = (LockType)EditorGUILayout.EnumPopup("Triggers:", triggerLock);
            playerLock      = (LockType)EditorGUILayout.EnumPopup("Player:", playerLock);
            saveLock        = (LockType)EditorGUILayout.EnumPopup("Saving:", saveLock);

            if (AdvGame.GetReferences() != null && AdvGame.GetReferences().settingsManager != null && AdvGame.GetReferences().settingsManager.inputMethod == InputMethod.KeyboardOrController)
            {
                keyboardGameplayMenusLock = (LockType)EditorGUILayout.EnumPopup("Control in-game Menus:", keyboardGameplayMenusLock);
            }

            AfterRunningOption();
        }
예제 #4
0
    /// <summary>
    /// Returns all tiles that are in movement range, taking into account blockyblocks etc.
    /// </summary>
    //KESKEN
    public List <Tile> TilesInRange(Tile startTile, int movementPoints, MovementMethod method)
    {
        List <Tile> returnables     = new List <Tile>();
        List <Tile> truereturnables = new List <Tile>();
        int         movementLeft    = movementPoints;

        switch (method)
        {
        case MovementMethod.Teleport:
            List <Tile> lastIteration = new List <Tile>();
            lastIteration.Add(startTile);
            while (movementLeft > 0)
            {
                List <Tile> tempList = new List <Tile>();
                foreach (var tile1 in lastIteration)
                {
                    if (tile1 != null)
                    {
                        tempList = tempList.Union(tile1.GetTNeighbouringTiles()).ToList();
                        //Debug.Log("Returnables count: " + returnables.Count());
                    }
                }
                returnables   = returnables.Union(tempList).ToList();
                lastIteration = tempList;
                movementLeft--;
            }
            break;

        case MovementMethod.Walk:
            pathTiles = WithinWalkingDistance(startTile, movementPoints);
            if (pathTiles != null)
            {
                foreach (var pathTile in pathTiles)
                {
                    truereturnables.Add(pathTile._tile);
                }
            }
            else
            {
                //Debug.Log("Path was null!");
            }
            break;

        default:
            break;
        }
        foreach (var tile in returnables)
        {
            if (tile != null)
            {
                if (tile.myType == Tile.BlockType.BaseBlock)
                {
                    truereturnables.Add(tile);
                }
            }
        }
        return(truereturnables);
    }
예제 #5
0
 protected virtual void Start()
 {
     currentMovement       = MoveTank;
     currentRotationMethod = RotateTank;
     specialAttackMethods  = new SpecialAttackMethod[] { FireMissile, SpawnShield, SpeedBoost, Heal, SuperHeal, DeployMine, SuperShots };
     currentSpecialAttack  = Nothing;
     directSliderTF        = healthSlider.gameObject.GetComponentInParent <Transform>();
     delayedSliderTF       = healthSliderDelayed.gameObject.GetComponentInParent <Transform>();
     InitializeStats();
 }
예제 #6
0
        /**
         * <summary>Creates a new instance of the 'Engine: Manage systems' Action</summary>
         * <param name = "newMovementMethod">The game's new movement method</param>
         * <param name = "cursorLock">Whether or not to disable the cursor system</param>
         * <param name = "inputLock">Whether or not to disable the input system</param>
         * <param name = "interactionLock">Whether or not to disable the interaction system</param>
         * <param name = "menuLock">Whether or not to disable the menu system</param>
         * <param name = "movementLock">Whether or not to disable the movement system</param>
         * <param name = "cameraLock">Whether or not to disable the camera system</param>
         * <param name = "triggerLock">Whether or not to disable the trigger system</param>
         * <param name = "playerLock">Whether or not to disable the player system</param>
         * <param name = "saveLock">Whether or not to disable the save system</param>
         * <param name = "directControlInGameMenusLock">Whether or not to allow direct-navigation of in-game menus</param>
         * <returns>The generated Action</returns>
         */
        public static ActionSystemLock CreateNew(MovementMethod newMovementMethod, LockType cursorLock = LockType.NoChange, LockType inputLock = LockType.NoChange, LockType interactionLock = LockType.NoChange, LockType menuLock = LockType.NoChange, LockType movementLock = LockType.NoChange, LockType cameraLock = LockType.NoChange, LockType triggerLock = LockType.NoChange, LockType playerLock = LockType.NoChange, LockType saveLock = LockType.NoChange, LockType directControlInGameMenusLock = LockType.NoChange)
        {
            ActionSystemLock newAction = (ActionSystemLock)CreateInstance <ActionSystemLock>();

            newAction.changeMovementMethod      = true;
            newAction.newMovementMethod         = newMovementMethod;
            newAction.cursorLock                = cursorLock;
            newAction.inputLock                 = inputLock;
            newAction.interactionLock           = interactionLock;
            newAction.menuLock                  = menuLock;
            newAction.movementLock              = movementLock;
            newAction.cameraLock                = cameraLock;
            newAction.triggerLock               = triggerLock;
            newAction.playerLock                = playerLock;
            newAction.saveLock                  = saveLock;
            newAction.keyboardGameplayMenusLock = directControlInGameMenusLock;
            return(newAction);
        }
예제 #7
0
 public void aStarPathBuilder() {
     treasuresChanged = false;
     currentTreasure = targetTreasures.Peek();
     OrderedPair tresLoc = generateTresurePositionAsOrderedPair();    //PEEKS AT TOP OF QUEUE
     OrderedPair myLoc = generateMyPositionAsOrderedPair();
     if (tresLoc != null && myLoc != null) {
         tressure_path = scene.Map.findShortestPath(myLoc, tresLoc);
     }
     if (tressure_path.Count != 0) {
         queue = tressure_path;
         loadReturnPath();
         previous = queue.Dequeue();
         previousMovementMethod = currentMovementMethod;
         foreach(OrderedPair O in queue) {
             scene.WayPoints[(int)O.Z, (int)O.X].changeCubeColor(Color.Chocolate);
         }
     } else {
         System.Console.WriteLine("INDEX_ERROR: Could not build Path");
     }
 }
        override public void ShowGUI()
        {
            changeMovementMethod = EditorGUILayout.BeginToggleGroup("Change movement method?", changeMovementMethod);
            newMovementMethod    = (MovementMethod)EditorGUILayout.EnumPopup("Movement method:", newMovementMethod);
            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.Space();

            cursorLock      = (LockType)EditorGUILayout.EnumPopup("Cursor:", cursorLock);
            inputLock       = (LockType)EditorGUILayout.EnumPopup("Input:", inputLock);
            interactionLock = (LockType)EditorGUILayout.EnumPopup("Interactions:", interactionLock);
            menuLock        = (LockType)EditorGUILayout.EnumPopup("Menus:", menuLock);
            movementLock    = (LockType)EditorGUILayout.EnumPopup("Movement:", movementLock);
            cameraLock      = (LockType)EditorGUILayout.EnumPopup("Camera:", cameraLock);
            triggerLock     = (LockType)EditorGUILayout.EnumPopup("Triggers:", triggerLock);
            playerLock      = (LockType)EditorGUILayout.EnumPopup("Player:", playerLock);
            saveLock        = (LockType)EditorGUILayout.EnumPopup("Saving:", saveLock);

            AfterRunningOption();
        }
예제 #9
0
    private void InitAnimal()
    {
        m_traits = m_genome.GetAllTraits();
        float canFly = GetTrait("flying") - GetTrait("size");

        if (canFly > 0)
        {
            m_traits["flyingHeight"] = canFly * 5f;
            m_movementMethod         = MovementMethod.FLY;
            m_rigidbody.gravityScale = 0f;
        }
        m_traits["age"] = 0f;
        if (m_presetted)
        {
            m_traits["age"] = Random.Range(0f, GetTrait("lifetime"));
        }
        m_traits["currentSize"] = GetTrait("size") * 0.5f;
        float size = GetTrait("size") * 0.5f;

        m_view.SetBodyPart("Head", m_genome.Head.skeletonAsset);
        m_view.SetBodyPart("Front", m_genome.Body.skeletonAsset);
        m_view.SetBodyPart("Rear", m_genome.Legs.skeletonAsset);
        transform.localScale = new Vector3(size, size, 1f);
        m_active             = true;
        Invoke("Die", GetTrait("lifetime"));

        if (m_traits.ContainsKey("stomachSize"))
        {
            m_traits["stomachFullness"] = m_traits["stomachSize"];
            m_hungerFactor = GameController.GetInstance().animalHungerFactor;
        }

        // new animal never had sex before
        m_timeSinceLastMating = GameController.GetInstance().defaultMatingCooldown;

        Hud[] huds = Resources.FindObjectsOfTypeAll <Hud>();
        foreach (Hud hud in huds)
        {
            hud.UpdateHud();
        }
    }
        public override void ShowGUI()
        {
            changeMovementMethod = EditorGUILayout.BeginToggleGroup ("Change movement method?", changeMovementMethod);
            newMovementMethod = (MovementMethod) EditorGUILayout.EnumPopup ("Movement method:", newMovementMethod);
            EditorGUILayout.EndToggleGroup ();

            EditorGUILayout.Space ();

            cursorLock = (LockType) EditorGUILayout.EnumPopup ("Cursor:", cursorLock);
            inputLock = (LockType) EditorGUILayout.EnumPopup ("Input:", inputLock);
            interactionLock = (LockType) EditorGUILayout.EnumPopup ("Interactions:", interactionLock);
            menuLock = (LockType) EditorGUILayout.EnumPopup ("Menus:", menuLock);
            movementLock = (LockType) EditorGUILayout.EnumPopup ("Movement:", movementLock);
            cameraLock = (LockType) EditorGUILayout.EnumPopup ("Camera:", cameraLock);
            triggerLock = (LockType) EditorGUILayout.EnumPopup ("Triggers:", triggerLock);
            playerLock = (LockType) EditorGUILayout.EnumPopup ("Player:", playerLock);
            saveLock = (LockType) EditorGUILayout.EnumPopup ("Saving:", saveLock);

            AfterRunningOption ();
        }
예제 #11
0
        private void ShowPage()
        {
            GUI.skin.label.wordWrap = true;

            if (pageNumber == 0)
            {
                if (logo != null)
                {
                    GUILayout.Label(logo);
                }
                GUILayout.Space(5f);
                GUILayout.Label("This window can help you get started with making a new Adventure Creator game.");
                GUILayout.Label("To begin, click 'Next'. Changes will not be implemented until you are finished.");
            }

            else if (pageNumber == 1)
            {
                GUILayout.Label("Enter a name for your game. This will be used for filenames, so alphanumeric characters only.");
                gameName = GUILayout.TextField(gameName);
            }

            else if (pageNumber == 2)
            {
                GUILayout.Label("What kind of perspective will your game have?");
                cameraPerspective_int = EditorGUILayout.Popup(cameraPerspective_int, cameraPerspective_list);

                if (cameraPerspective_int == 0)
                {
                    GUILayout.Space(5f);
                    GUILayout.Label("By default, 2D games are built entirely in the X-Z plane, and characters are scaled to achieve a depth effect.\nIf you prefer, you can position your characters in 3D space, so that they scale accurately due to camera perspective.");
                    screenSpace = EditorGUILayout.ToggleLeft("I'll position my characters in 3D space", screenSpace);
                }
                else if (cameraPerspective_int == 1)
                {
                    GUILayout.Space(5f);
                    GUILayout.Label("2.5D games mixes 3D characters with 2D backgrounds. By default, 2.5D games group several backgrounds into one scene, and swap them out according to the camera angle.\nIf you prefer, you can work with just one background in a scene, to create a more traditional 2D-like adventure.");
                    oneScenePerBackground = EditorGUILayout.ToggleLeft("I'll work with one background per scene", oneScenePerBackground);
                }
                else if (cameraPerspective_int == 2)
                {
                    GUILayout.Label("3D games can still have sprite-based Characters, but having a true 3D environment is more flexible so far as Player control goes. How should your Player character be controlled?");
                    movementMethod = (MovementMethod)EditorGUILayout.EnumPopup(movementMethod);
                }
            }

            else if (pageNumber == 3)
            {
                if (cameraPerspective_int == 1 && !oneScenePerBackground)
                {
                    GUILayout.Label("Do you want to play the game ONLY with a keyboard or controller?");
                    directControl = EditorGUILayout.ToggleLeft("Yes", directControl);
                    GUILayout.Space(5f);
                }
                else if (cameraPerspective_int == 2 && movementMethod == MovementMethod.Drag)
                {
                    GUILayout.Label("Is your game designed for Touch-screen devices?");
                    touchScreen = EditorGUILayout.ToggleLeft("Yes", touchScreen);
                    GUILayout.Space(5f);
                }

                GUILayout.Label("How do you want to interact with Hotspots?");
                interactionMethod = (AC_InteractionMethod)EditorGUILayout.EnumPopup(interactionMethod);
                if (interactionMethod == AC_InteractionMethod.ContextSensitive)
                {
                    EditorGUILayout.HelpBox("This method simplifies interactions to either Use, Examine, or Use Inventory. Hotspots can be interacted with in just one click.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    EditorGUILayout.HelpBox("This method emulates the classic 'Sierra-style' interface, in which the player chooses from a list of verbs, and then the Hotspot they wish to interact with.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    EditorGUILayout.HelpBox("This method involves first choosing a Hotspot, and then from a range of available interactions, which can be customised in the Editor.", MessageType.Info);
                }
            }

            else if (pageNumber == 4)
            {
                GUILayout.Label("Please choose what interface you would like to start with. It can be changed at any time - this is just to help you get started.");
                wizardMenu = (WizardMenu)EditorGUILayout.EnumPopup(wizardMenu);
            }

            else if (pageNumber == 5)
            {
                GUILayout.Label("The following values have been set based on your choices. Please review them and amend if necessary, then click 'Finish' to create your game template.");
                GUILayout.Space(5f);

                gameName = EditorGUILayout.TextField("Game name:", gameName);
                cameraPerspective_int = (int)cameraPerspective;
                cameraPerspective_int = EditorGUILayout.Popup("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
                cameraPerspective     = (CameraPerspective)cameraPerspective_int;

                if (cameraPerspective == CameraPerspective.TwoD)
                {
                    movingTurning = (MovingTurning)EditorGUILayout.EnumPopup("Moving and turning:", movingTurning);
                }

                movementMethod    = (MovementMethod)EditorGUILayout.EnumPopup("Movement method:", movementMethod);
                inputMethod       = (InputMethod)EditorGUILayout.EnumPopup("Input method:", inputMethod);
                interactionMethod = (AC_InteractionMethod)EditorGUILayout.EnumPopup("Interaction method:", interactionMethod);
                hotspotDetection  = (HotspotDetection)EditorGUILayout.EnumPopup("Hotspot detection method:", hotspotDetection);

                wizardMenu = (WizardMenu)EditorGUILayout.EnumPopup("GUI type:", wizardMenu);
            }

            else if (pageNumber == 6)
            {
                GUILayout.Label("Congratulations, your game's Managers have been set up!");
                GUILayout.Space(5f);
                GUILayout.Label("Your scene objects have also been organised for Adventure Creator to use. Your next step is to create and set your Player prefab, which you can assign in your Settings Manager.");
            }
        }
예제 #12
0
		public void ShowGUI ()
		{
			EditorGUILayout.LabelField ("Save game settings", EditorStyles.boldLabel);
			
			if (saveFileName == "")
			{
				saveFileName = SaveSystem.SetProjectName ();
			}
			saveFileName = EditorGUILayout.TextField ("Save filename:", saveFileName);
			#if !UNITY_WEBPLAYER && !UNITY_ANDROID
			saveTimeDisplay = (SaveTimeDisplay) EditorGUILayout.EnumPopup ("Time display:", saveTimeDisplay);
			takeSaveScreenshots = EditorGUILayout.ToggleLeft ("Take screenshot when saving?", takeSaveScreenshots);
			#else
			EditorGUILayout.HelpBox ("Save-game screenshots are disabled for WebPlayer and Android platforms.", MessageType.Info);
			takeSaveScreenshots = false;
			#endif
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Cutscene settings:", EditorStyles.boldLabel);
			
			actionListOnStart = (ActionListAsset) EditorGUILayout.ObjectField ("ActionList on start game:", actionListOnStart, typeof (ActionListAsset), false);
			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);
			if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent ())
			{
				EditorGUILayout.HelpBox ("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
			}

			inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod);
			interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod);
			
			if (inputMethod != InputMethod.TouchScreen)
			{
				useOuya = EditorGUILayout.ToggleLeft ("Playing on OUYA platform?", useOuya);
				if (useOuya && !OuyaIntegration.IsDefinePresent ())
				{
					EditorGUILayout.HelpBox ("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
				}
				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 (selectInteractions == SelectInteractions.CyclingCursorAndClickingHotspot)
					{
						cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Cycle through Inventory items too?", cycleInventoryCursors);
						autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Auto-cycle after an Interaction?", autoCycleWhenInteract);
					}
				
					if (SelectInteractionMethod () == SelectInteractions.ClickingMenu)
					{
						cancelInteractions = (CancelInteractions) EditorGUILayout.EnumPopup ("Close interactions with:", cancelInteractions);
					}
					else
					{
						cancelInteractions = CancelInteractions.CursorLeavesMenus;
					}
				}
			}
			if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
			{
				autoCycleWhenInteract = EditorGUILayout.ToggleLeft ("Reset cursor after an Interaction?", autoCycleWhenInteract);
			}
			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 (IsInFirstPerson ())
			{
				disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft ("Disable free-aim when dragging?", disableFreeAimWhenDragging);
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Inventory settings", EditorStyles.boldLabel);
			
			reverseInventoryCombinations = EditorGUILayout.ToggleLeft ("Combine interactions work in reverse?", reverseInventoryCombinations);
			if (interactionMethod != AC_InteractionMethod.ContextSensitive)
			{
				inventoryInteractions = (InventoryInteractions) EditorGUILayout.EnumPopup ("Inventory interactions:", inventoryInteractions);
			}
			if (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single)
			{
				inventoryDragDrop = EditorGUILayout.ToggleLeft ("Drag and drop Inventory interface?", inventoryDragDrop);
				if (!inventoryDragDrop)
				{
					inventoryDisableLeft = EditorGUILayout.ToggleLeft ("Left-click deselects active item?", inventoryDisableLeft);
					if (interactionMethod == AC_InteractionMethod.ContextSensitive || inventoryInteractions == InventoryInteractions.Single)
					{
						rightClickInventory = (RightClickInventory) EditorGUILayout.EnumPopup ("Right-click active item:", rightClickInventory);
					}
					
					if (movementMethod == MovementMethod.PointAndClick)
					{
						canMoveWhenActive = EditorGUILayout.ToggleLeft ("Can move player if an Item is active?", canMoveWhenActive);
					}
				}
				else
				{
					inventoryDropLook = EditorGUILayout.ToggleLeft ("Can drop an Item onto itself to Examine it?", inventoryDropLook);
				}
				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);
				hideSelectedFromMenu = EditorGUILayout.ToggleLeft ("Hide currently active Item in Menu?", hideSelectedFromMenu);
			}
			activeWhenHover = EditorGUILayout.ToggleLeft ("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover);
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Required inputs:", EditorStyles.boldLabel);
			EditorGUILayout.HelpBox ("The following inputs are available for the chosen interface settings:" + GetInputList (), MessageType.Info);
			
			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)
			{
				directMovementType = (DirectMovementType) EditorGUILayout.EnumPopup ("Direct-movement type:", directMovementType);
				if (directMovementType == DirectMovementType.RelativeToCamera)
				{
					limitDirectMovement = (LimitDirectMovement) EditorGUILayout.EnumPopup ("Movement limitation:", limitDirectMovement);
				}
			}
			else if (movementMethod == MovementMethod.PointAndClick)
			{
				clickPrefab = (Transform) EditorGUILayout.ObjectField ("Click marker:", clickPrefab, typeof (Transform), false);
				walkableClickRange = EditorGUILayout.Slider ("NavMesh search %:", walkableClickRange, 0f, 1f);
				doubleClickMovement = EditorGUILayout.Toggle ("Double-click to move?", doubleClickMovement);
			}
			if (movementMethod == MovementMethod.StraightToCursor)
			{
				dragRunThreshold = EditorGUILayout.FloatField ("Run threshold:", dragRunThreshold);
				singleTapStraight = EditorGUILayout.Toggle ("Single-click works too?", singleTapStraight);
			}
			if (movementMethod == MovementMethod.FirstPerson && inputMethod == InputMethod.TouchScreen)
			{
				dragAffects = (DragAffects) EditorGUILayout.EnumPopup ("Touch-drag affects:", dragAffects);
			}
			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 (inputMethod == InputMethod.TouchScreen)
			{
				EditorGUILayout.Space ();
				EditorGUILayout.LabelField ("Touch Screen settings", EditorStyles.boldLabel);
				
				offsetTouchCursor = EditorGUILayout.Toggle ("Drag cursor with touch?", offsetTouchCursor);
				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 ("Hotpot 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);
			}
			
			if (cameraPerspective != CameraPerspective.TwoD)
			{
				playerFacesHotspots = EditorGUILayout.Toggle ("Player turns head to active?", playerFacesHotspots);
			}
			
			hotspotIconDisplay = (HotspotIconDisplay) EditorGUILayout.EnumPopup ("Display Hotspot icon:", hotspotIconDisplay);
			if (hotspotIconDisplay != HotspotIconDisplay.Never)
			{
				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);
			}
			
			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 ("Loading scene", EditorStyles.boldLabel);
			useLoadingScreen = EditorGUILayout.Toggle ("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);
				}
			}
			
			EditorGUILayout.Space ();
			EditorGUILayout.LabelField ("Options data", EditorStyles.boldLabel);
			
			if (!PlayerPrefs.HasKey (ppKey))
			{
				optionsData = new OptionsData ();
				optionsBinary = Serializer.SerializeObjectBinary (optionsData);
				PlayerPrefs.SetString (ppKey, optionsBinary);
			}
			
			optionsBinary = PlayerPrefs.GetString (ppKey);
			optionsData = Serializer.DeserializeObjectBinary <OptionsData> (optionsBinary);
			
			optionsData.speechVolume = EditorGUILayout.Slider ("Speech volume:", optionsData.speechVolume, 0f, 1f);
			optionsData.musicVolume = EditorGUILayout.Slider ("Music volume:", optionsData.musicVolume, 0f, 1f);
			optionsData.sfxVolume = EditorGUILayout.Slider ("SFX volume:", optionsData.sfxVolume, 0f, 1f);
			optionsData.showSubtitles = EditorGUILayout.Toggle ("Show subtitles?", optionsData.showSubtitles);
			optionsData.language = EditorGUILayout.IntField ("Language:", optionsData.language);
			
			optionsBinary = Serializer.SerializeObjectBinary (optionsData);
			PlayerPrefs.SetString (ppKey, optionsBinary);
			
			if (GUILayout.Button ("Reset options data"))
			{
				PlayerPrefs.DeleteKey ("Options");
				optionsData = new OptionsData ();
				Debug.Log ("PlayerPrefs cleared");
			}
			
			if (GUI.changed)
			{
				EditorUtility.SetDirty (this);
			}
		}
예제 #13
0
 /**
  * <summary>Initialises the cursor lock based on a given movement method.</summary>
  * <param name = "movementMethod">The new movement method</param>
  */
 public void InitialiseCursorLock(MovementMethod movementMethod)
 {
     if (KickStarter.settingsManager.IsInFirstPerson () && movementMethod != MovementMethod.FirstPerson)
     {
         cursorIsLocked = false;
     }
     else if (!KickStarter.settingsManager.IsInFirstPerson () && movementMethod == MovementMethod.FirstPerson)
     {
         cursorIsLocked = KickStarter.settingsManager.lockCursorOnStart;
     }
 }
 public void SetMovementMethod(MovementMethod method)
 {
     _movMethod = method;
 }
예제 #15
0
        public NPAvatar(Scene scene, string label, Vector3 pos, Vector3 orientAxis,float radians, string meshFile)
                        : base(scene, label, pos, orientAxis, radians, meshFile) {  
            first.Name =  "npFirst";
            follow.Name = "npFollow";
            above.Name =  "npAbove";
            stepSize = 40;
            random = new Random();
            move = true;
            cellsVisited = new Boolean[512,512];
            for (int row = 0; row < scene.Range; row++) {
                for(int col = 0; col < scene.Range; col++) {
                    cellsVisited[row, col] = false;
                }
            }
            Vector3 oldTranslation = Orientation.Translation;
            Orientation *= Matrix.CreateTranslation(-1 * Orientation.Translation);
            Orientation *= Matrix.CreateRotationY(90 * MathHelper.Pi / 180);
            Orientation *= Matrix.CreateTranslation(oldTranslation);
            targetTreasures = null;
            bearing = null;
            targetTreasures = new Queue<Model3D>();
            inverse_tressure_path = new Stack<Queue<OrderedPair>>();
            scene.PAUSE = false;
            currentTreasure = null;
            previousTreasure = null;
            destinationExploring = null;
            currentWayPoint = 1;
            direction = true;
            wayPointsToExplore = new OrderedPair [] {
                                                        new OrderedPair(504,0,504),
                                                        new OrderedPair(352,0,496),
                                                        new OrderedPair(16,0,496),
                                                        new OrderedPair(16,0,16),
                                                        new OrderedPair(32,0,16),
                                                        new OrderedPair(32,0,488),
                                                        new OrderedPair(48,0,488),
                                                        new OrderedPair(48,0,16),
                                                        new OrderedPair(64,0,16),
                                                        new OrderedPair(64,0,488),
                                                        new OrderedPair(80,0,488),
                                                        new OrderedPair(80,0,16),
                                                        new OrderedPair(96,0,16),
                                                        new OrderedPair(96,0,488),
                                                        new OrderedPair(112,0,488),
                                                        new OrderedPair(112,0,16),

                                                        new OrderedPair(128,0,16),
                                                        new OrderedPair(128,0,488),

                                                        new OrderedPair(144,0,488),
                                                        new OrderedPair(144,0,16),

                                                        new OrderedPair(160,0,16),
                                                        new OrderedPair(160,0,488),

                                                        new OrderedPair(176,0,488),
                                                        new OrderedPair(176,0,16),

                                                        new OrderedPair(192,0,16),
                                                        new OrderedPair(192,0,488),

                                                        new OrderedPair(208,0,488),
                                                        new OrderedPair(208,0,16),

                                                        new OrderedPair(224,0,16),
                                                        new OrderedPair(225,0,488),
                                                    };

            /*  STATE VARIABLES */
            previousMovementMethod = MovementMethod.NONE;
            currentMovementMethod = MovementMethod.NONE;
            path_builder = PathBuildMethod.NONE;
            wayPointReached = false;
            treasuresChanged = false;
            returnedToOrigin = true;
        }
예제 #16
0
        public void STATE_MACHINE_FUNCTION_TO_DETERMINE_MOVEMENT_METHOD_THIS_IS_KEY() {
            if(currentWayPoint == wayPointsToExplore.Length && wayPointReached) {
                direction = false;
                currentWayPoint=wayPointsToExplore.Length-2;
            }
            if(currentWayPoint == -1 && WayPointReached) {
                direction = true;
                currentWayPoint = 1;
            }
            //if (treasureCount() == 0){
            //    treasuresChanged = false;
            //}

            /*
             *  WHEN THE GAME STARTS FIRST STATE IS TO BUILD EXPLORER PATH
             *  THIS IS ALSO THE STATE WHERE YOU RETURN WHEN YOU HIT A WAY
             *  POINT IN THE EXPLORER PATH
             */
            if  ( 
                    treasureCount() == 0 &&
                    path_builder == PathBuildMethod.NONE &&
                    previousMovementMethod == MovementMethod.NONE &&
                    currentMovementMethod == MovementMethod.NONE && 
                    !(WayPointReached || treasuresChanged) &&
                    returnedToOrigin
                ) {
                
                status = "FIRST STATE";
                path_builder = PathBuildMethod.EXPLORER_PATH;
                previousMovementMethod = MovementMethod.BUILD_PATH;
                currentMovementMethod = MovementMethod.BUILD_PATH;
                //printStateVariables(1);
            } 
            
            /*
             *  STATES THAT DEAL IF YOU GO INTO EXPLORER PATH FIRST
             */
            else if (
		                treasureCount() == 0 &&
                        path_builder == PathBuildMethod.EXPLORER_PATH &&
                        previousMovementMethod == MovementMethod.BUILD_PATH &&
                        currentMovementMethod == MovementMethod.BUILD_PATH &&
                        !(wayPointReached || treasuresChanged) &&
                        returnedToOrigin
                    ) {
                status = "SWITCHING TO EXPLORER";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = currentMovementMethod;
                currentMovementMethod = MovementMethod.EXPLORER;
                //printStateVariables(2);
            } else if(  treasureCount() == 0 &&
                        path_builder == PathBuildMethod.NONE && 
                        previousMovementMethod == MovementMethod.BUILD_PATH && 
                        currentMovementMethod == MovementMethod.EXPLORER &&
                        !(wayPointReached || treasuresChanged) &&
                        returnedToOrigin
                     ) {
                status = "FIRST STEP EVER -- GOING TO EXPLORE";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = currentMovementMethod;
                currentMovementMethod = MovementMethod.EXPLORER;
                //printStateVariables(3);                     
            } else if(  treasureCount() == 0 &&
                        path_builder == PathBuildMethod.NONE && 
                        previousMovementMethod == MovementMethod.EXPLORER && 
                        currentMovementMethod == MovementMethod.EXPLORER &&
                        !(wayPointReached || treasuresChanged) &&
                        returnedToOrigin
                     ) {
                status = "EXPLORING";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = currentMovementMethod;
                currentMovementMethod = MovementMethod.EXPLORER;
                //printStateVariables(3);                     
            } else if(  treasureCount() == 0 && 
                        path_builder == PathBuildMethod.NONE && 
                        previousMovementMethod == MovementMethod.EXPLORER && 
                        currentMovementMethod == MovementMethod.EXPLORER && 
                        wayPointReached &&
                        !treasuresChanged &&
                        returnedToOrigin
                     ) {
                status = "RENEW EXPLORER PATH";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = MovementMethod.NONE;
                currentMovementMethod = MovementMethod.NONE;
                wayPointReached = false;
                //printStateVariables(4);
            }

            /*
            *  STATES THAT DEAL WITH IF YOU HAVE TREASURES SITED
            */
            else if(    treasureCount() != 0 && 
                        path_builder == PathBuildMethod.NONE &&
                        previousMovementMethod == MovementMethod.EXPLORER &&
                        currentMovementMethod == MovementMethod.EXPLORER &&
                        !(wayPointReached || treasuresChanged) &&
                        returnedToOrigin
                    ) {
                status = "FOUND TREASURE BUILDING PATH";
                path_builder = PathBuildMethod.A_STAR_PATH;
                previousMovementMethod = MovementMethod.BUILD_PATH;
                currentMovementMethod = MovementMethod.BUILD_PATH;
                //printStateVariables(5);
            } else if(  treasureCount() != 0 && 
                        path_builder == PathBuildMethod.A_STAR_PATH &&
                        previousMovementMethod == MovementMethod.BUILD_PATH &&
                        currentMovementMethod == MovementMethod.BUILD_PATH &&
                        !(wayPointReached || treasuresChanged) &&
                        returnedToOrigin
                    ) {
                status = "SWITCHING TO TREASURE PATH";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = currentMovementMethod;
                currentMovementMethod = MovementMethod.TRESSURE;
                //printStateVariables(6);
            } else if(  treasureCount() != 0 && 
                        path_builder == PathBuildMethod.NONE &&
                        previousMovementMethod == MovementMethod.BUILD_PATH &&
                        currentMovementMethod == MovementMethod.TRESSURE &&
                        !(wayPointReached || treasuresChanged) &&
                        returnedToOrigin
                    ) {
                status = "FIRST STEP TOWARDS -- TREASURE";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = currentMovementMethod;
                currentMovementMethod = MovementMethod.TRESSURE;
                //printStateVariables(7);
            } else if(  treasureCount() != 0 && 
                        path_builder == PathBuildMethod.NONE &&
                        previousMovementMethod == MovementMethod.TRESSURE &&
                        currentMovementMethod == MovementMethod.TRESSURE &&
                        !(wayPointReached || treasuresChanged) &&
                        returnedToOrigin
                    ) {
                status = "GETTING TREASURE";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = currentMovementMethod;
                currentMovementMethod = MovementMethod.TRESSURE;
                //printStateVariables(8);
            } else if(  treasureCount() != 0 && 
                        path_builder == PathBuildMethod.NONE &&
                        previousMovementMethod == MovementMethod.TRESSURE &&
                        currentMovementMethod == MovementMethod.TRESSURE &&
                        !(wayPointReached || !treasuresChanged) &&
                        returnedToOrigin
                    ) {
                status = "ANOTHER TREASURE FOUND -- SETTING PATH";
                path_builder = PathBuildMethod.A_STAR_PATH;
                previousMovementMethod = MovementMethod.BUILD_PATH;
                currentMovementMethod = MovementMethod.BUILD_PATH;
                //printStateVariables(9);
            }

           /*
            *  STATES THAT DEAL WITH IF YOU HAVE TREASURES OBTAINED
            *  ALL SITED TREASURE AND NEED TO RETURN TO EXPLORER PATH
            */
            else if(    treasureCount() == 0 && 
                        path_builder == PathBuildMethod.NONE &&
                        previousMovementMethod == MovementMethod.TRESSURE &&
                        currentMovementMethod == MovementMethod.TRESSURE &&
                        !(wayPointReached || !treasuresChanged) &&
                        returnedToOrigin//RETURNED TO ORIGING SET AFTER THIS
                    ) {
                status = "SETTING UP RETURN PATH";
                path_builder = PathBuildMethod.SET_RETURN_TO_EXPLORER_PATH;
                previousMovementMethod = MovementMethod.BUILD_PATH;
                currentMovementMethod = MovementMethod.BUILD_PATH;
                //printStateVariables(10);
            } else if(  treasureCount() == 0 && 
                        path_builder == PathBuildMethod.SET_RETURN_TO_EXPLORER_PATH &&
                        previousMovementMethod == MovementMethod.BUILD_PATH &&
                        currentMovementMethod == MovementMethod.BUILD_PATH && 
                        !wayPointReached &&
                        treasuresChanged &&
                        !returnedToOrigin
                    ) {
                status = "FIRST STEP BACK TO RETURN PATH";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = currentMovementMethod;
                currentMovementMethod = MovementMethod.RETURN_TO_EXPLORER_PATH;
                //printStateVariables(11);
            }else if(  treasureCount() == 0 && 
                        path_builder == PathBuildMethod.NONE &&
                        previousMovementMethod == MovementMethod.BUILD_PATH &&
                        currentMovementMethod == MovementMethod.RETURN_TO_EXPLORER_PATH &&
                        !wayPointReached &&
                        treasuresChanged &&
                        !returnedToOrigin
                    ) {
                status = "ON RETURN PATH";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = currentMovementMethod;
                currentMovementMethod = MovementMethod.RETURN_TO_EXPLORER_PATH;
                //printStateVariables(12);
            }else if(  treasureCount() == 0 && 
                        path_builder == PathBuildMethod.NONE &&
                        previousMovementMethod == MovementMethod.RETURN_TO_EXPLORER_PATH &&
                        currentMovementMethod == MovementMethod.RETURN_TO_EXPLORER_PATH &&
                        !wayPointReached &&
                        treasuresChanged &&
                        !returnedToOrigin
                    ) {
                status = "ON RETURN PATH";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = currentMovementMethod;
                currentMovementMethod = MovementMethod.RETURN_TO_EXPLORER_PATH;
                //printStateVariables(13);
            }else if(  treasureCount() == 0 && 
                        path_builder == PathBuildMethod.NONE &&
                        previousMovementMethod == MovementMethod.RETURN_TO_EXPLORER_PATH &&
                        currentMovementMethod == MovementMethod.RETURN_TO_EXPLORER_PATH &&
                        !wayPointReached &&
                        treasuresChanged &&
                        returnedToOrigin
                    ) {
                status = "BACK AT WHERE I LEFT OFF IN EXPLORER PATH";
                path_builder = PathBuildMethod.NONE;
                previousMovementMethod = MovementMethod.EXPLORER;
                currentMovementMethod = MovementMethod.EXPLORER;
                treasuresChanged = false;
                foreach(OrderedPair O in queue) {
                    scene.WayPoints[(int)O.Z, (int)O.X].changeCubeColor(Color.Green);
                }
                //printStateVariables(14);
            }

            /*  
             *  THIS IS JUST IN THE "CASE" THAT I MISSED A TRANSITION
             *  IN MY STATE MACHINE
             */
            else {
                scene.PAUSE = true;
                printStateVariables(-1);
            }

        }
예제 #17
0
 public static void ChangeSetting(MovementMethod value)
 {
     m_InputMappings.AltMoveMethod = value;
 }
        private void Process()
        {
            if (cameraPerspective_int == 0)
            {
                cameraPerspective = CameraPerspective.TwoD;
                if (screenSpace)
                {
                    movingTurning = MovingTurning.ScreenSpace;
                }
                else
                {
                    movingTurning = MovingTurning.Unity2D;
                }

                movementMethod = MovementMethod.PointAndClick;
                inputMethod = InputMethod.MouseAndKeyboard;
                hotspotDetection = HotspotDetection.MouseOver;
            }
            else if (cameraPerspective_int == 1)
            {
                if (oneScenePerBackground)
                {
                    cameraPerspective = CameraPerspective.TwoD;
                    movingTurning = MovingTurning.ScreenSpace;
                    movementMethod = MovementMethod.PointAndClick;
                    inputMethod = InputMethod.MouseAndKeyboard;
                    hotspotDetection = HotspotDetection.MouseOver;
                }
                else
                {
                    cameraPerspective = CameraPerspective.TwoPointFiveD;

                    if (directControl)
                    {
                        movementMethod = MovementMethod.Direct;
                        inputMethod = InputMethod.KeyboardOrController;
                        hotspotDetection = HotspotDetection.PlayerVicinity;
                    }
                    else
                    {
                        movementMethod = MovementMethod.PointAndClick;
                        inputMethod = InputMethod.MouseAndKeyboard;
                        hotspotDetection = HotspotDetection.MouseOver;
                    }
                }
            }
            else if (cameraPerspective_int == 2)
            {
                cameraPerspective = CameraPerspective.ThreeD;
                hotspotDetection = HotspotDetection.MouseOver;

                inputMethod = InputMethod.MouseAndKeyboard;
                if (movementMethod == MovementMethod.Drag)
                {
                    if (touchScreen)
                    {
                        inputMethod = InputMethod.TouchScreen;
                    }
                    else
                    {
                        inputMethod = InputMethod.MouseAndKeyboard;
                    }
                }
            }
        }
        private void Process()
        {
            if (cameraPerspective_int == 0)
            {
                cameraPerspective = CameraPerspective.TwoD;
                if (screenSpace)
                {
                    movingTurning = MovingTurning.ScreenSpace;
                }
                else
                {
                    movingTurning = MovingTurning.Unity2D;
                }

                movementMethod   = MovementMethod.PointAndClick;
                inputMethod      = InputMethod.MouseAndKeyboard;
                hotspotDetection = HotspotDetection.MouseOver;
            }
            else if (cameraPerspective_int == 1)
            {
                if (oneScenePerBackground)
                {
                    cameraPerspective = CameraPerspective.TwoD;
                    movingTurning     = MovingTurning.ScreenSpace;
                    movementMethod    = MovementMethod.PointAndClick;
                    inputMethod       = InputMethod.MouseAndKeyboard;
                    hotspotDetection  = HotspotDetection.MouseOver;
                }
                else
                {
                    cameraPerspective = CameraPerspective.TwoPointFiveD;

                    if (directControl)
                    {
                        movementMethod   = MovementMethod.Direct;
                        inputMethod      = InputMethod.KeyboardOrController;
                        hotspotDetection = HotspotDetection.PlayerVicinity;
                    }
                    else
                    {
                        movementMethod   = MovementMethod.PointAndClick;
                        inputMethod      = InputMethod.MouseAndKeyboard;
                        hotspotDetection = HotspotDetection.MouseOver;
                    }
                }
            }
            else if (cameraPerspective_int == 2)
            {
                cameraPerspective = CameraPerspective.ThreeD;
                hotspotDetection  = HotspotDetection.MouseOver;

                inputMethod = InputMethod.MouseAndKeyboard;
                if (movementMethod == MovementMethod.Drag)
                {
                    if (touchScreen)
                    {
                        inputMethod = InputMethod.TouchScreen;
                    }
                    else
                    {
                        inputMethod = InputMethod.MouseAndKeyboard;
                    }
                }
            }

                        #if ON_MOBILE
            inputMethod = InputMethod.TouchScreen;
                        #endif
        }
예제 #20
0
        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);
            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

            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);
            if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent ())
            {
                EditorGUILayout.HelpBox ("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
            }

            inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod);
            interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod);

            if (inputMethod != InputMethod.TouchScreen)
            {
                useOuya = EditorGUILayout.ToggleLeft ("Playing on OUYA platform?", useOuya);
                if (useOuya && !OuyaIntegration.IsDefinePresent ())
                {
                    EditorGUILayout.HelpBox ("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
                }
                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);
                onlyInteractWhenCursorUnlocked = EditorGUILayout.ToggleLeft ("Disallow Interactions if cursor is locked?", onlyInteractWhenCursorUnlocked);
            }
            if (IsInFirstPerson ())
            {
                disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft ("Disable free-aim when dragging?", 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 Interaction cycles?", cycleInventoryCursors);
                    }
                    else
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft ("Include Inventory items in 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 (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single)
            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 if (inventoryInteractions == AC.InventoryInteractions.Single)
                {
                    inventoryDropLook = EditorGUILayout.ToggleLeft ("Can drop an Item onto itself to Examine 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);
            hideSelectedFromMenu = EditorGUILayout.ToggleLeft ("Hide currently active Item in Menu?", hideSelectedFromMenu);
            activeWhenHover = EditorGUILayout.ToggleLeft ("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover);

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Required inputs:", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox ("The following inputs are available for the chosen interface settings:" + GetInputList (), MessageType.Info);

            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);
                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);
                doubleClickMovement = EditorGUILayout.Toggle ("Double-click to move?", doubleClickMovement);
            }
            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.FirstPerson && inputMethod == InputMethod.TouchScreen)
            {
                dragAffects = (DragAffects) EditorGUILayout.EnumPopup ("Touch-drag affects:", dragAffects);
            }
            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 && movementMethod != MovementMethod.StraightToCursor)
            {
                experimentalAccuracy = EditorGUILayout.ToggleLeft ("Attempt to be super-accurate? (Experimental)", experimentalAccuracy);
            }

            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);
                }
                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 ("Hotpot 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 icon:", hotspotIconDisplay);
            if (hotspotIconDisplay != HotspotIconDisplay.Never)
            {
                if (cameraPerspective != CameraPerspective.TwoD)
                {
                    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 ("Loading scene", EditorStyles.boldLabel);
            useLoadingScreen = EditorGUILayout.Toggle ("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);
                }
            }

            EditorGUILayout.Space ();
            EditorGUILayout.LabelField ("Options data", EditorStyles.boldLabel);

            optionsData = Options.LoadPrefsFromID (0, false, true);
            if (optionsData == null)
            {
                Debug.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);

            if (GUI.changed)
            {
                EditorUtility.SetDirty (this);
            }
        }
        private void ShowPage()
        {
            GUI.skin.label.wordWrap = true;

            if (pageNumber == 0)
            {
                if (Resource.ACLogo)
                {
                    GUI.DrawTexture(new Rect(82, 25, 256, 128), Resource.ACLogo);
                }
                GUILayout.Space(140f);
                GUILayout.Label("New Game Wizard", CustomStyles.managerHeader);

                GUILayout.Space(5f);
                GUILayout.Label("This window can help you get started with making a new Adventure Creator game.");
                GUILayout.Label("To begin, click 'Next'. Changes will not be implemented until you are finished.");
            }

            else if (pageNumber == 1)
            {
                GUILayout.Label("Enter a name for your game. This will be used for filenames, so alphanumeric characters only.");
                gameName = GUILayout.TextField(gameName);
            }

            else if (pageNumber == 2)
            {
                GUILayout.Label("What kind of perspective will your game have?");
                cameraPerspective_int = EditorGUILayout.Popup(cameraPerspective_int, cameraPerspective_list);

                if (cameraPerspective_int == 0)
                {
                    GUILayout.Space(5f);
                    GUILayout.Label("By default, 2D games are built entirely in the X-Z plane, and characters are scaled to achieve a depth effect.\nIf you prefer, you can position your characters in 3D space, so that they scale accurately due to camera perspective.");
                    screenSpace = EditorGUILayout.ToggleLeft("I'll position my characters in 3D space", screenSpace);
                }
                else if (cameraPerspective_int == 1)
                {
                    GUILayout.Space(5f);
                    GUILayout.Label("2.5D games mixes 3D characters with 2D backgrounds. By default, 2.5D games group several backgrounds into one scene, and swap them out according to the camera angle.\nIf you prefer, you can work with just one background in a scene, to create a more traditional 2D-like adventure.");
                    oneScenePerBackground = EditorGUILayout.ToggleLeft("I'll work with one background per scene", oneScenePerBackground);
                }
                else if (cameraPerspective_int == 2)
                {
                    GUILayout.Label("3D games can still have sprite-based Characters, but having a true 3D environment is more flexible so far as Player control goes. How should your Player character be controlled?");
                    movementMethod = (MovementMethod)EditorGUILayout.EnumPopup(movementMethod);
                }
            }

            else if (pageNumber == 3)
            {
                if (cameraPerspective_int == 1 && !oneScenePerBackground)
                {
                    GUILayout.Label("Do you want to play the game ONLY with a keyboard or controller?");
                    directControl = EditorGUILayout.ToggleLeft("Yes", directControl);
                    GUILayout.Space(5f);
                }
                else if (cameraPerspective_int == 2 && movementMethod == MovementMethod.Drag)
                {
                    GUILayout.Label("Is your game designed for Touch-screen devices?");
                    touchScreen = EditorGUILayout.ToggleLeft("Yes", touchScreen);
                    GUILayout.Space(5f);
                }

                GUILayout.Label("How do you want to interact with Hotspots?");
                interactionMethod = (AC_InteractionMethod)EditorGUILayout.EnumPopup(interactionMethod);
                if (interactionMethod == AC_InteractionMethod.ContextSensitive)
                {
                    EditorGUILayout.HelpBox("This method simplifies interactions to either Use, Examine, or Use Inventory. Hotspots can be interacted with in just one click.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    EditorGUILayout.HelpBox("This method emulates the classic 'Sierra-style' interface, in which the player chooses from a list of verbs, and then the Hotspot they wish to interact with.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    EditorGUILayout.HelpBox("This method involves first choosing a Hotspot, and then from a range of available interactions, which can be customised in the Editor.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.CustomScript)
                {
                    EditorGUILayout.HelpBox("See the Manual's 'Custom interaction systems' section for information on how to trigger Hotspots and inventory items.", MessageType.Info);
                }
            }

            else if (pageNumber == 4)
            {
                GUILayout.Label("Please choose what interface you would like to start with. It can be changed at any time - this is just to help you get started.");
                wizardMenu = (WizardMenu)EditorGUILayout.EnumPopup(wizardMenu);

                if (wizardMenu == WizardMenu.DefaultAC || wizardMenu == WizardMenu.DefaultUnityUI)
                {
                    MenuManager    defaultMenuManager    = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    CursorManager  defaultCursorManager  = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                    ActionsManager defaultActionsManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;

                    if (defaultMenuManager == null || defaultCursorManager == null || defaultActionsManager == null)
                    {
                        EditorGUILayout.HelpBox("Unable to locate the default Manager assets in '" + Resource.MainFolderPath + "/Default'. These assets must be imported in order to start with the default interface.", MessageType.Warning);
                    }
                }

                if (wizardMenu == WizardMenu.Blank)
                {
                    EditorGUILayout.HelpBox("Your interface will be completely blank - no cursor icons will exist either.\r\n\r\nThis option is not recommended for those still learning how to use AC.", MessageType.Info);
                }
                else if (wizardMenu == WizardMenu.DefaultAC)
                {
                    EditorGUILayout.HelpBox("This mode uses AC's built-in Menu system and not Unity UI.\r\n\r\nUnity UI prefabs will also be created for each Menu, however, so that you can make use of them later if you choose.", MessageType.Info);
                }
                else if (wizardMenu == WizardMenu.DefaultUnityUI)
                {
                    EditorGUILayout.HelpBox("This mode relies on Unity UI to handle the interface.\r\n\r\nCopies of the UI prefabs will be stored in a UI subdirectory, for you to edit.", MessageType.Info);
                }
            }

            else if (pageNumber == 5)
            {
                GUILayout.Label("The following values have been set based on your choices. Please review them and amend if necessary, then click 'Finish' to create your game template.");
                GUILayout.Space(5f);

                gameName = EditorGUILayout.TextField("Game name:", gameName);
                cameraPerspective_int = (int)cameraPerspective;
                cameraPerspective_int = EditorGUILayout.Popup("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
                cameraPerspective     = (CameraPerspective)cameraPerspective_int;

                if (cameraPerspective == CameraPerspective.TwoD)
                {
                    movingTurning = (MovingTurning)EditorGUILayout.EnumPopup("Moving and turning:", movingTurning);
                }

                movementMethod    = (MovementMethod)EditorGUILayout.EnumPopup("Movement method:", movementMethod);
                inputMethod       = (InputMethod)EditorGUILayout.EnumPopup("Input method:", inputMethod);
                interactionMethod = (AC_InteractionMethod)EditorGUILayout.EnumPopup("Interaction method:", interactionMethod);
                hotspotDetection  = (HotspotDetection)EditorGUILayout.EnumPopup("Hotspot detection method:", hotspotDetection);

                wizardMenu = (WizardMenu)EditorGUILayout.EnumPopup("GUI type:", wizardMenu);
            }

            else if (pageNumber == 6)
            {
                GUILayout.Label("Congratulations, your game's Managers have been set up!");
                GUILayout.Space(5f);
                GUILayout.Label("Your next step is to create and set your Player prefab, which you can do using the Character Wizard.");
            }
        }
예제 #22
0
        public void ShowGUI()
        {
            EditorGUILayout.LabelField("Save game settings", EditorStyles.boldLabel);

            if (saveFileName == "")
            {
                saveFileName = SaveSystem.SetProjectName();
            }
            saveFileName = EditorGUILayout.TextField("Save filename:", saveFileName);
                        #if !UNITY_WEBPLAYER && !UNITY_ANDROID
            saveTimeDisplay     = (SaveTimeDisplay)EditorGUILayout.EnumPopup("Time display:", saveTimeDisplay);
            takeSaveScreenshots = EditorGUILayout.ToggleLeft("Take screenshot when saving?", takeSaveScreenshots);
                        #else
            EditorGUILayout.HelpBox("Save-game screenshots are disabled for WebPlayer and Android platforms.", MessageType.Info);
            takeSaveScreenshots = false;
                        #endif

            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);
            if (movementMethod == MovementMethod.UltimateFPS && !UltimateFPSIntegration.IsDefinePresent())
            {
                EditorGUILayout.HelpBox("The 'UltimateFPSIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
            }

            inputMethod       = (InputMethod)EditorGUILayout.EnumPopup("Input method:", inputMethod);
            interactionMethod = (AC_InteractionMethod)EditorGUILayout.EnumPopup("Interaction method:", interactionMethod);

            if (inputMethod != InputMethod.TouchScreen)
            {
                useOuya = EditorGUILayout.ToggleLeft("Playing on OUYA platform?", useOuya);
                if (useOuya && !OuyaIntegration.IsDefinePresent())
                {
                    EditorGUILayout.HelpBox("The 'OUYAIsPresent' preprocessor define must be declared in the Player Settings.", MessageType.Warning);
                }
                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)
                    {
                        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);
            }
            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);
            onlyInteractWhenCursorUnlocked = EditorGUILayout.ToggleLeft("Disallow Interactions if cursor is unlocked?", onlyInteractWhenCursorUnlocked);
            if (IsInFirstPerson())
            {
                disableFreeAimWhenDragging = EditorGUILayout.ToggleLeft("Disable free-aim when dragging?", disableFreeAimWhenDragging);
            }
            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 Interaction cycles?", cycleInventoryCursors);
                    }
                    else
                    {
                        cycleInventoryCursors = EditorGUILayout.ToggleLeft("Include Inventory items in 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 (interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction || inventoryInteractions == InventoryInteractions.Single)
            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 if (inventoryInteractions == AC.InventoryInteractions.Single)
                {
                    inventoryDropLook = EditorGUILayout.ToggleLeft("Can drop an Item onto itself to Examine 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);
            hideSelectedFromMenu = EditorGUILayout.ToggleLeft("Hide currently active Item in Menu?", hideSelectedFromMenu);
            activeWhenHover      = EditorGUILayout.ToggleLeft("Show Active FX when Cursor hovers over Item in Menu?", activeWhenHover);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Required inputs:", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox("The following inputs are available for the chosen interface settings:" + GetInputList(), MessageType.Info);

            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);
                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);
                doubleClickMovement = EditorGUILayout.Toggle("Double-click to move?", doubleClickMovement);
            }
            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.FirstPerson && inputMethod == InputMethod.TouchScreen)
            {
                dragAffects = (DragAffects)EditorGUILayout.EnumPopup("Touch-drag affects:", dragAffects);
            }
            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 (inputMethod == InputMethod.TouchScreen)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Touch Screen settings", EditorStyles.boldLabel);

                offsetTouchCursor = EditorGUILayout.Toggle("Drag cursor with touch?", offsetTouchCursor);
                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("Hotpot 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.Toggle("Player turns head to active?", playerFacesHotspots);
            }

            hotspotIconDisplay = (HotspotIconDisplay)EditorGUILayout.EnumPopup("Display Hotspot icon:", hotspotIconDisplay);
            if (hotspotIconDisplay != HotspotIconDisplay.Never)
            {
                if (cameraPerspective != CameraPerspective.TwoD)
                {
                    occludeIcons = EditorGUILayout.Toggle("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 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("Loading scene", EditorStyles.boldLabel);
            useLoadingScreen = EditorGUILayout.Toggle("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);
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Options data", EditorStyles.boldLabel);

            if (!PlayerPrefs.HasKey(ppKey))
            {
                optionsData   = new OptionsData();
                optionsBinary = Serializer.SerializeObjectBinary(optionsData);
                PlayerPrefs.SetString(ppKey, optionsBinary);
            }

            optionsBinary = PlayerPrefs.GetString(ppKey);
            if (optionsBinary.Length > 0)
            {
                optionsData = Serializer.DeserializeObjectBinary <OptionsData> (optionsBinary);
            }
            else
            {
                optionsData = new 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);

            optionsBinary = Serializer.SerializeObjectBinary(optionsData);
            PlayerPrefs.SetString(ppKey, optionsBinary);

            if (GUILayout.Button("Reset options data"))
            {
                PlayerPrefs.DeleteKey("Options");
                optionsData = new OptionsData();
                Debug.Log("PlayerPrefs cleared");
            }

            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);


            if (GUI.changed)
            {
                EditorUtility.SetDirty(this);
            }
        }
        private void ShowPage()
        {
            GUI.skin.label.wordWrap = true;

            if (pageNumber == 0)
            {
                if (logo != null)
                {
                    GUILayout.Label (logo);
                }
                GUILayout.Space (5f);
                GUILayout.Label ("This window can help you get started with making a new Adventure Creator game.");
                GUILayout.Label ("To begin, click 'Next'. Changes will not be implemented until you are finished.");
            }

            else if (pageNumber == 1)
            {
                GUILayout.Label ("Enter a name for your game. This will be used for filenames, so alphanumeric characters only.");
                gameName = GUILayout.TextField (gameName);
            }

            else if (pageNumber == 2)
            {
                GUILayout.Label ("What kind of perspective will your game have?");
                cameraPerspective_int = EditorGUILayout.Popup (cameraPerspective_int, cameraPerspective_list);

                if (cameraPerspective_int == 0)
                {
                    GUILayout.Space (5f);
                    GUILayout.Label ("By default, 2D games are built entirely in the X-Z plane, and characters are scaled to achieve a depth effect.\nIf you prefer, you can position your characters in 3D space, so that they scale accurately due to camera perspective.");
                    screenSpace = EditorGUILayout.ToggleLeft ("I'll position my characters in 3D space", screenSpace);
                }
                else if (cameraPerspective_int == 1)
                {
                    GUILayout.Space (5f);
                    GUILayout.Label ("2.5D games mixes 3D characters with 2D backgrounds. By default, 2.5D games group several backgrounds into one scene, and swap them out according to the camera angle.\nIf you prefer, you can work with just one background in a scene, to create a more traditional 2D-like adventure.");
                    oneScenePerBackground = EditorGUILayout.ToggleLeft ("I'll work with one background per scene", oneScenePerBackground);
                }
                else if (cameraPerspective_int == 2)
                {
                    GUILayout.Label ("3D games can still have sprite-based Characters, but having a true 3D environment is more flexible so far as Player control goes. How should your Player character be controlled?");
                    movementMethod = (MovementMethod) EditorGUILayout.EnumPopup (movementMethod);
                }
            }

            else if (pageNumber == 3)
            {
                if (cameraPerspective_int == 1 && !oneScenePerBackground)
                {
                    GUILayout.Label ("Do you want to play the game ONLY with a keyboard or controller?");
                    directControl = EditorGUILayout.ToggleLeft ("Yes", directControl);
                    GUILayout.Space (5f);
                }
                else if (cameraPerspective_int == 2 && movementMethod == MovementMethod.Drag)
                {
                    GUILayout.Label ("Is your game designed for Touch-screen devices?");
                    touchScreen = EditorGUILayout.ToggleLeft ("Yes", touchScreen);
                    GUILayout.Space (5f);
                }

                GUILayout.Label ("How do you want to interact with Hotspots?");
                interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup (interactionMethod);
                if (interactionMethod == AC_InteractionMethod.ContextSensitive)
                {
                    EditorGUILayout.HelpBox ("This method simplifies interactions to either Use, Examine, or Use Inventory. Hotspots can be interacted with in just one click.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot)
                {
                    EditorGUILayout.HelpBox ("This method emulates the classic 'Sierra-style' interface, in which the player chooses from a list of verbs, and then the Hotspot they wish to interact with.", MessageType.Info);
                }
                else if (interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction)
                {
                    EditorGUILayout.HelpBox ("This method involves first choosing a Hotspot, and then from a range of available interactions, which can be customised in the Editor.", MessageType.Info);
                }
            }

            else if (pageNumber == 4)
            {
                GUILayout.Label ("Please choose what interface you would like to start with. It can be changed at any time - this is just to help you get started.");
                wizardMenu = (WizardMenu) EditorGUILayout.EnumPopup (wizardMenu);
            }

            else if (pageNumber == 5)
            {
                GUILayout.Label ("The following values have been set based on your choices. Please review them and amend if necessary, then click 'Finish' to create your game template.");
                GUILayout.Space (5f);

                gameName = EditorGUILayout.TextField ("Game name:", gameName);
                cameraPerspective_int = (int) cameraPerspective;
                cameraPerspective_int = EditorGUILayout.Popup ("Camera perspective:", cameraPerspective_int, cameraPerspective_list);
                cameraPerspective = (CameraPerspective) cameraPerspective_int;

                if (cameraPerspective == CameraPerspective.TwoD)
                {
                    movingTurning = (MovingTurning) EditorGUILayout.EnumPopup ("Moving and turning:", movingTurning);
                }

                movementMethod = (MovementMethod) EditorGUILayout.EnumPopup ("Movement method:", movementMethod);
                inputMethod = (InputMethod) EditorGUILayout.EnumPopup ("Input method:", inputMethod);
                interactionMethod = (AC_InteractionMethod) EditorGUILayout.EnumPopup ("Interaction method:", interactionMethod);
                hotspotDetection = (HotspotDetection) EditorGUILayout.EnumPopup ("Hotspot detection method:", hotspotDetection);

                wizardMenu = (WizardMenu) EditorGUILayout.EnumPopup ("GUI type:", wizardMenu);
            }

            else if (pageNumber == 6)
            {
                GUILayout.Label ("Congratulations, your game's Managers have been set up!");
                GUILayout.Space (5f);
                GUILayout.Label ("Your scene objects have also been organised for Adventure Creator to use. Your next step is to create and set your Player prefab, which you can assign in your Settings Manager.");
            }
        }
예제 #24
0
        /**
         * <summary>Initialises the cursor lock based on a given movement method.</summary>
         * <param name = "movementMethod">The new movement method</param>
         */
        public void InitialiseCursorLock(MovementMethod movementMethod)
        {
            if (KickStarter.settingsManager.IsInFirstPerson () && movementMethod != MovementMethod.FirstPerson && movementMethod != MovementMethod.UltimateFPS)
            {
                cursorIsLocked = false;
            }
            else if (!KickStarter.settingsManager.IsInFirstPerson () && (movementMethod == MovementMethod.FirstPerson || movementMethod == MovementMethod.UltimateFPS))
            {
                cursorIsLocked = KickStarter.settingsManager.lockCursorOnStart;
            }

            if (movementMethod == MovementMethod.UltimateFPS)
            {
                UltimateFPSIntegration.SetCameraState (IsCursorLocked ());
            }
        }