예제 #1
0
    /** Handles all possible keyboard controls / shortcuts. */
    private void HandleKeyboardInput()
    {
        if (saveDialog != null && saveDialog.gameObject.activeSelf)
        {
            return;
        }

        if (Input.anyKeyDown)
        {
            // J = place Joint
            if (Input.GetKeyDown(KeyCode.J))
            {
                SelectedPart = BuildSelection.Joint;
            }

            // B = place body connection
            else if (Input.GetKeyDown(KeyCode.B))
            {
                SelectedPart = BuildSelection.Bone;
            }

            // M = place muscle
            else if (Input.GetKeyDown(KeyCode.M))
            {
                SelectedPart = BuildSelection.Muscle;
            }

            // D = Delete component
            else if (Input.GetKeyDown(KeyCode.D))
            {
                SelectedPart = BuildSelection.Delete;
            }

            // S = Save Creature
            else if (Input.GetKeyDown(KeyCode.S) && Application.platform != RuntimePlatform.WebGLPlayer)
            {
                //SaveCreature();
                //PromptCreatureSave();
            }

            // L = Load Creature
            else if (Input.GetKeyDown(KeyCode.L))
            {
                //LoadCreature();
            }

            // E = Go to Evolution Scene
            else if (Input.GetKeyDown(KeyCode.E))
            {
                Evolve();
            }

            // P = Print the current creature's save string
            else if (Input.GetKeyDown(KeyCode.P))
            {
                print(CreatureSaver.CreateSaveInfoFromCreature(joints, bones, muscles));
            }


            buttonManager.selectButton(selectedPart);
        }
    }