Пример #1
0
    // Use this for initialization
    void Start()
    {
        audioSource    = GetComponent <AudioSource>();
        camPerspective = FindObjectOfType <CameraPerspective>();

        player1Track = new Track(this, PlayerType.Player1);
        player2Track = new Track(this, PlayerType.Player2);

        UpdateTurnState(TurnStates.ROLLING);
    }
 void SwitchCameraPerspectiveInput()
 {
     if (Input.GetButtonDown(SwitchPerspectiveInput))
     {
         if (cameraPerspective == CameraPerspective.FirstPerson)
         {
             cameraPerspective = CameraPerspective.ThirdPerson;
         }
         else
         {
             cameraPerspective = CameraPerspective.FirstPerson;
         }
     }
 }
Пример #3
0
    void Update()
    {
        n = NewBehaviourScript.m;
        if (n == 3 && flag == true)
        {
            GameObject tempObj = GameObject.Find("Sphere");
            scriptInstance = tempObj.GetComponent <NewBehaviourScript>();
            GameObject tempObj2 = GameObject.Find("Main Camera");
            scriptInstance2 = tempObj2.GetComponent <CameraPerspective>();
            GameObject tempObj3 = GameObject.Find("Canvas");
            scriptInstanceGameOver = tempObj3.GetComponent <GameoverManager>();
            //Access playerScore variable from ScriptA

            flag = false;
        }
    }
Пример #4
0
        public override void LoadContent()
        {
            this.deadUnits = new Queue <Unit>();
            this.active    = true;
            var aspectRatio = DisplayManager.Instance.Dimensions.X / DisplayManager.Instance.Dimensions.Y;

            this.camera = new CameraPerspective(
                aspectRatio,
                new Vector3(50, 30, 0));

            this.terrain = new HomeTerrain(DisplayManager.Instance.GraphicsDevice, UsersManager.CurrentPlayer.HomeSeed, new Vector3(-400, 0, -400));

            this.skybox = new Skybox(DisplayManager.Instance.GraphicsDevice);

            if (!UsersManager.CurrentPlayer.AllEntities.Any())
            {
                var random        = new Random();
                var numberOfTrees = random.Next(300, 400);

                for (int i = 0; i < numberOfTrees; i++)
                {
                    var x      = random.Next(-200, 200);
                    var z      = random.Next(-200, 200);
                    var weight = random.Next(5, 10);
                    var y      = 100;

                    var tree = new Tree(Guid.NewGuid(), UsersManager.CurrentPlayer.Id, new Vector3(x, y, z), Quaternion.Identity, weight);
                    Client.Socket.Writer.Send(Message.Create(Service.AddResProv, ResProvFactory.ToDto(tree)));

                    UsersManager.CurrentPlayer.ResourceProviders.Add(tree);
                    UsersManager.CurrentPlayer.AllEntities.Add(tree);
                }
            }
            else
            {
                foreach (var entity in UsersManager.CurrentPlayer.AllEntities)
                {
                    entity.LoadModel();
                }
            }

            this.updateThread = new Thread(this.SendUpdates);

            this.updateThread.Start();
        }
Пример #5
0
        public EditorModel(IModelRegistry registry) : base(registry)
        {
            _registry = (ModelRegistry)registry;
            _random   = new Random();

            _lastUpdateTime    = 0.0f;
            _scrollWheelBefore = 0;
            _cursorLocked      = true;

            _camera = new CameraPerspective {
                FarClip = 100
            };

            _player         = new Player(Vector3.UnitY);
            _world          = new World(new Vector3I(2, 2, 2));
            _materialAmount = Constant.MaxMaterialAmount;
            _materialID     = 1;
            //TestInitVoxels();
        }
Пример #6
0
        protected virtual void InternalInitialise(SceneType sceneType)
        {
            //	Add the default camera.
            currentCamera           = new CameraPerspective();
            currentCamera.Translate = new Vertex(-5.0f, 8.0f, 10.0f);
            cameras.Add(currentCamera);

            //	Find out how many lights OpenGL can support.
            int [] umaxlights = new int[1];
            gl.GetInteger(OpenGL.MAX_LIGHTS, umaxlights);

            //	Now create as many lights as we can.
            for (uint u = 0; u < umaxlights[0]; u++)
            {
                Light light = new Light();
                light.GLCode = OpenGL.LIGHT0 + u;
                light.Name   = "Light " + u.ToString();
                if (u == 0)
                {
                    light.Ambient = new GLColor(1.0f, 1.0f, 1.0f, 0.0f);
                    light.Diffuse = new GLColor(1.0f, 1.0f, 1.0f, 0.0f);
                    light.On      = true;
                }
                lights.Add(light);
            }

            //	Set the scene type.
            SetSceneType(sceneType);

            //	Initialise stock drawing.
            gl.InitialiseStockDrawing();

            //	Set the Scene OpenGL for the quadrics and nurbs.
            Quadric.SceneOpenGL   = OpenGL;
            NURBSBase.SceneOpenGL = OpenGL;
        }
        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.");
            }
        }
        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;
                    }
                }
            }
        }
Пример #9
0
 public void SetOverrideCameraPerspective(CameraPerspective _cameraPerspective, MovingTurning _movingTurning)
 {
     overrideCameraPerspective = true;
     cameraPerspective         = _cameraPerspective;
     movingTurning             = _movingTurning;
 }
        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.");
            }
        }
        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
        }
Пример #12
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.");
            }
        }
Пример #13
0
        public Tabuleiro(char rotulo, Objeto paiRef, CameraPerspective c) : base(rotulo, paiRef)
        {
            camera = c;

            // adiciona chão
            addPontosFaces(-9.1f, 9.1f, -0.2f, 0.0f, 9.1f, -9.1f);

            int   posTrilha = 8;
            float inicio_x  = -0.7f;
            float inicio_z  = 8.9f;

            // adiciona os pontos das plataformas da trilha - listaPto[8] a
            for (int i = 1; i <= 12; i++)
            {
                // se i != 1 começa a contar em 2, pois a primeira peça já foi adicionada
                // se i == 3, 6, 9 ou 12, então possui somente 3 peças na fileira, senão possui 7
                for (int j = (i == 1 ? 1 : 2); (i % 3 == 0 ? j <= 3 : j <= 7); j++)
                {
                    trilha.Add(posTrilha);
                    addPontosFaces(inicio_x - 1f, inicio_x, 0.0f, 0.2f, inicio_z, inicio_z - 1f);

                    // salva a posição das plataformas importantes do jogo
                    if (i == 1 && j == 2)
                    {
                        posJogadorAzul = trilha.Count - 1;
                    }
                    else if (i == 7 && j == 2)
                    {
                        posJogadorVermelho = trilha.Count - 1;
                    }
                    else if (i == 6 && j == 2)
                    {
                        posTerminaVermelho = trilha.Count - 1;
                    }
                    else if (i == 12 && j == 2)
                    {
                        posTerminaAzul = trilha.Count - 1;
                    }

                    posTrilha += QUANTIDADE_PONTOS;

                    // muda as variáveis para a próxima plataforma
                    if ((i % 3 == 0 && j != 3) || (i % 3 != 0 && j != 7))
                    {
                        if (i == 1 || i == 3 || i == 5)
                        {
                            inicio_z -= 1.2f;
                        }
                        else if (i == 2 || i == 10 || i == 12)
                        {
                            inicio_x -= 1.2f;
                        }
                        else if (i == 4 || i == 6 || i == 8)
                        {
                            inicio_x += 1.2f;
                        }
                        else if (i == 7 || i == 9 || i == 11)
                        {
                            inicio_z += 1.2f;
                        }
                    }
                }

                if (i == 12 || i == 2 || i == 4)
                {
                    inicio_z -= 1.2f;
                }

                else if (i == 1 || i == 9 || i == 11)
                {
                    inicio_x -= 1.2f;
                }
                else if (i == 3 || i == 5 || i == 7)
                {
                    inicio_x += 1.2f;
                }
                else if (i == 6 || i == 8 || i == 10)
                {
                    inicio_z += 1.2f;
                }
            }

            inicio_x = 0.5f;
            inicio_z = 7.7f;

            for (int i = 1; i <= 13; i++)
            {
                if (i <= 6)
                {
                    caminhoAzul.Add(posTrilha);
                }
                else if (i == 7)
                {
                    posDado = posTrilha;
                }
                else
                {
                    caminhoVermelho.Add(posTrilha);
                }

                addPontosFaces(inicio_x - 1f, inicio_x, 0.0f, 0.2f, inicio_z, inicio_z - 1f);

                posTrilha += 8;

                // muda as variáveis para a próxima plataforma
                inicio_z -= 1.2f;
            }

            // adiciona os pontos da casa azul
            // muros da casa
            casaAzul.Add(posTrilha);
            casaAzul.Add(posTrilha + 8);
            casaAzul.Add(posTrilha + 16);
            casaAzul.Add(posTrilha + 24);
            addPontosFaces(-2.9f, -1.9f, 0.0f, 0.6f, 6.5f, 1.9f);
            addPontosFaces(-8.9f, -2.9f, 0.0f, 0.6f, 2.9f, 1.9f);
            addPontosFaces(-8.9f, -7.9f, 0.0f, 0.6f, 8.9f, 2.9f);
            addPontosFaces(-7.9f, -1.9f, 0.0f, 0.6f, 8.9f, 7.9f);

            posTrilha += 32;

            // plataformas das peças
            posCasaAzul = posTrilha;
            casaAzul.Add(posTrilha);
            casaAzul.Add(posTrilha + 8);
            casaAzul.Add(posTrilha + 16);
            casaAzul.Add(posTrilha + 24);
            addPontosFaces(-5.0f, -3.6f, 0.0f, 0.2f, 7.2f, 5.8f);
            addPontosFaces(-7.2f, -5.8f, 0.0f, 0.2f, 7.2f, 5.8f);
            addPontosFaces(-5.0f, -3.6f, 0.0f, 0.2f, 5.0f, 3.6f);
            addPontosFaces(-7.2f, -5.8f, 0.0f, 0.2f, 5.0f, 3.6f);

            posTrilha += 32;

            // plataformas das peças salvas
            salvoAzul.Add(posTrilha);
            salvoAzul.Add(posTrilha + 8);
            salvoAzul.Add(posTrilha + 16);
            salvoAzul.Add(posTrilha + 24);
            addPontosFaces(3.6f, 5.0f, 0.0f, 0.2f, 7.2f, 5.8f);
            addPontosFaces(5.8f, 7.2f, 0.0f, 0.2f, 7.2f, 5.8f);
            addPontosFaces(3.6f, 5.0f, 0.0f, 0.2f, 5.0f, 3.6f);
            addPontosFaces(5.8f, 7.2f, 0.0f, 0.2f, 5.0f, 3.6f);

            posTrilha += 32;

            // adiciona os pontos da casa vermelha
            // muros da casa
            casaVermelha.Add(posTrilha);
            casaVermelha.Add(posTrilha + 8);
            casaVermelha.Add(posTrilha + 16);
            casaVermelha.Add(posTrilha + 24);
            addPontosFaces(1.9f, 2.9f, 0.0f, 0.6f, -1.9f, -6.5f);
            addPontosFaces(2.9f, 8.9f, 0.0f, 0.6f, -1.9f, -2.9f);
            addPontosFaces(7.9f, 8.9f, 0.0f, 0.6f, -2.9f, -8.9f);
            addPontosFaces(1.9f, 7.9f, 0.0f, 0.6f, -7.9f, -8.9f);

            posTrilha += 32;

            // plataformas das peças
            posCasaVermelha = posTrilha;
            casaVermelha.Add(posTrilha);
            casaVermelha.Add(posTrilha + 8);
            casaVermelha.Add(posTrilha + 16);
            casaVermelha.Add(posTrilha + 24);
            addPontosFaces(3.6f, 5.0f, 0.0f, 0.2f, -5.8f, -7.2f);
            addPontosFaces(5.8f, 7.2f, 0.0f, 0.2f, -5.8f, -7.2f);
            addPontosFaces(3.6f, 5.0f, 0.0f, 0.2f, -3.6f, -5.0f);
            addPontosFaces(5.8f, 7.2f, 0.0f, 0.2f, -3.6f, -5.0f);

            posTrilha += 32;

            // plataformas das peças salvas
            salvoVermelho.Add(posTrilha);
            salvoVermelho.Add(posTrilha + 8);
            salvoVermelho.Add(posTrilha + 16);
            salvoVermelho.Add(posTrilha + 24);
            addPontosFaces(-5.0f, -3.6f, 0.0f, 0.2f, -5.8f, -7.2f);
            addPontosFaces(-7.2f, -5.8f, 0.0f, 0.2f, -5.8f, -7.2f);
            addPontosFaces(-5.0f, -3.6f, 0.0f, 0.2f, -3.6f, -5.0f);
            addPontosFaces(-7.2f, -5.8f, 0.0f, 0.2f, -3.6f, -5.0f);

            posTrilha += 32;

            Ponto4D pto;


            // adiciona dado
            pto      = getPontoInicialPeca(Ambiente.MEIO, 0, 0.8f);
            obj_Dado = new Dado(Utilitario.charProximo(), this, pto, 0.8f, new Cor(0, 0, 255, 255), new Cor(255, 0, 0, 255));

            Peca p;

            Cor cor = new Cor(0, 0, 255, 255);

            // adiciona peças azuis
            for (int i = 0; i < 4; i++)
            {
                pto = getPontoInicialPeca(Ambiente.CASA_AZUL, i, 0.6f);
                p   = new Peca(Utilitario.charProximo(), this, pto, 0.6f, 1, cor, Ambiente.CASA_AZUL, i);
                pecasAzuis.Add(p);
            }

            cor = new Cor(255, 0, 0, 255);

            // adiciona peças vermelhas
            for (int i = 0; i < 4; i++)
            {
                pto = getPontoInicialPeca(Ambiente.CASA_VERMELHA, i, 0.6f);
                p   = new Peca(Utilitario.charProximo(), this, pto, 0.6f, 2, cor, Ambiente.CASA_VERMELHA, i);
                pecasVermelhas.Add(p);
            }
        }
Пример #14
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);
            }
        }
Пример #15
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);
            }
        }
Пример #16
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);
			}
		}
Пример #17
0
        public X8Timer ShootTimer = new X8Timer(.5f);          //this will time how longer the player faces the recticle
        void Start()
        {
            innerShield = gameObject.GetComponentInChildren <RaydraShield>(); //!search for the sheild in the children of the parent object

            _myCamera = this.GetComponentInChildren <Camera>();               //get the camera that is connected to this game object
            bool ScoreMode = false;                                           //initally we are not in score mode

            //!the player info that unity will keep tract of
            p_fCameraAngleTheta        = 43f;                              //!initialize the angle that player if facing
            p_fCameraAnglePhi          = 45f;                              //!The camera is initially yyyyin this state
            p_fPlayerToFocusAngleTheta = 43f;                              //!initialize the angle that player if facing
            p_fPlayerToFocusAnglePhi   = 45f;                              //!//!initialize the angle that player if facing in the upward direction
            p_fJumpVelocity            = .40f;                             //!initialize the upward jump force
            ForceOfGravity             = 1f / 60f;                         //!this will have a unit per second force of gravity, in the downward direction
            p_fOrientationAngle        = 90f;                              //!Angle that the player is facing in degrees
            p_v3OrientationVect        = new Vector3(0, 0, 1f);            //!Direction player is facing represented as an angle
            p_v3PlayerToFocusVect      = new Vector3(0, 0, 0);             //!The vector the represents the direction the camera if facing
            p_v3PlayerToCameraVect     = new Vector3(0, 0, 0);             //!The Vector Data the represent the player to camera direction
            PlayerMovementState        = MovingState.IsStandingStill;      //!Intially the player is not moving
            PlayerJumpState            = JumpingState.NotJumping;          //!initlialize the the player is not jumping
            PlayerTackleHitState       = TackeHitState.NoContact;          //!Initial the tackle state of the player
            PlayerTackleState          = TackleState.IsNotTackling;        //!Initial the tackle state of the player
            PlayerAttackState          = AttackMode.NotFiringAbility;      //!Initial the shoot state of the player
            PlayerRaydraState          = RaydraState.NotInRaydraMode;      //!initailly the player is not in Raydra Mode
            PlayerCameraState          = CameraPerspective.Normal;         //!initially the camera to do nothing
            PlayerPhaseState           = PhaseState.IsNotPhasing;
            PlayerBallThrowState       = BallThrowingState.NotBeingThrown; //!Initial the vertical state of the player
            PlayerBallPossessionState  = BallPossessionState.HasBall;      //!Initial the Possession State of the player                                                         //	PlayerMotionVector = new Vector3 (this.transform.position.x,.transform.position.y,playerData.transform.position.z);
            p_v3PlayerVectorDirection  = Vector3.zero;                     //! This is direction that te player is headed as a vector
            _armWeapon    = this.GetComponentInChildren <RaydraWeapon>();  //!reference to the arm weapon on the player which is null to begin with
            p_bFacePlayer = false;                                         //! variable that determines weather or not to face the player, this variable determine weather or not this medthod is recursive
            p_fMass       = 0f;                                            //!initialize the mass of the player
            p_StateTime   = 0f;                                            // Time elasped in current state
            p_Collider    = null;                                          //initialize the first collider connect to this body
            pRidgidBody   = null;


            Controls = GetComponent <RaydraControls>();
            if (CameraFocusOverHead != null)
            {
                p_v3PlayerToCameraVect = CameraFocusOverHead.transform.position - _myCamera.transform.position;
            }
            p_fCameraAnglePhi          = Vector3.Angle(new Vector3(0, 1, 0), p_v3PlayerToCameraVect);
            p_fCameraAngleTheta        = Vector3.Angle(new Vector3(1, 0, 0), p_v3PlayerToCameraVect);
            p_fPlayerToFocusAnglePhi   = Vector3.Angle(new Vector3(0, 1, 0), p_v3PlayerToFocusVect);
            p_fPlayerToFocusAngleTheta = Vector3.Angle(new Vector3(1, 0, 0), p_v3PlayerToFocusVect);
            X8Animator = GetComponent <Animator>();
            isGrounded = false;
            if (p_v3PlayerToFocusVect.z < 0)
            {
                p_fPlayerToFocusAngleTheta = 360 - p_fPlayerToFocusAngleTheta; //make sure that the angle is at the correct corridinate
            }
            if (p_v3PlayerToCameraVect.z < 0)
            {
                p_fCameraAngleTheta = 360 - p_fCameraAngleTheta; //make sure that the angle is at the correct corridinate
            }
            TheBall    = FindObjectOfType <RaydraCellz>();
            X8Animator = GetComponent <Animator>(); //get the reference to the animator

            PlayerMovementState = MovingState.IsStandingStill;

            EnemyAI = GetComponent <Ai>(); //get the ai script attached to the player (if there is one)

            if (EnemyAI != null)
            {
                Debug.Log("enemy AI" + EnemyAI.ToString());
            }
        }