static void DemoPhysics()
    {
        ManagerPackage package = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/DemoPhysics/PhysicsDemo_ManagerPackage.asset", typeof(ManagerPackage)) as ManagerPackage;

        if (package != null)
        {
            if (!ACInstaller.IsInstalled())
            {
                ACInstaller.DoInstall();
            }

            package.AssignManagers();
            AdventureCreator.RefreshActions();

            if (UnityVersionHandler.GetCurrentSceneName() != "Office")
            {
                                #if UNITY_5_3 || UNITY_5_4 || UNITY_5_3_OR_NEWER
                bool canProceed = EditorUtility.DisplayDialog("Open demo scene", "Would you like to open the Physics Demo scene, Office, now?", "Yes", "No");
                if (canProceed)
                {
                    if (UnityVersionHandler.SaveSceneIfUserWants())
                    {
                        UnityEditor.SceneManagement.EditorSceneManager.OpenScene(Resource.MainFolderPath + "/DemoPhysics/Scenes/Office.unity");
                    }
                }
                                #else
                ACDebug.Log("Physics Demo managers loaded - you can now run the Physics Demo scene in '" + Resource.mainFolderPath + "/DemoPhysics/Scenes/Office.unity'");
                                #endif
            }

            AdventureCreator.Init();
        }
    }
Example #2
0
    static void Demo3D()
    {
        ManagerPackage package = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/ManagerPackage.asset", typeof(ManagerPackage)) as ManagerPackage;

        package.AssignManagers();
        AdventureCreator.RefreshActions();
    }
Example #3
0
    // Action messages
    private void ActionMessages(AdventureCreator myAdventure)
    {
        editorScript.numberOfMessages = myAdventure.zx81numberOfMessages;

        editorScript.actionMessage = new string[editorScript.numberOfMessages, NUMBER_OF_LINES];

        editorScript.temporaryMessageArray = new string[editorScript.numberOfMessages];


        for (int i = 1; i <= editorScript.numberOfMessages - 1; i++)
        {
            editorScript.temporaryMessageArray = myAdventure.zx81actionMessage;
        }

        // Message description index
        int k = 0;

        for (int i = 1; i <= editorScript.numberOfMessages - 1; i++)
        {
            for (int j = k; j <= (NUMBER_OF_LINES - 1) + k; j++)
            {
                editorScript.actionMessage[i, (j - k)] = editorScript.temporaryMessageArray[j];
            }

            k = k + NUMBER_OF_LINES;
        }
    }
Example #4
0
    static void Init()
    {
        // Get existing open window or if none, make a new one:
        AdventureCreator window = (AdventureCreator)EditorWindow.GetWindow(typeof(AdventureCreator));

        window.GetReferences();
    }
Example #5
0
    // Actions
    private static void Actions(AdventureEditor editorScript, AdventureCreator adventureData)
    {
        adventureData.zx81numberOfActions_A = editorScript.savedNumberOfActions_A;

        for (int i = 0; i <= adventureData.zx81numberOfActions_A; i++)
        {
            adventureData.zx81action_As = editorScript.savedAction_As;
        }
    }
Example #6
0
    // Conditions
    private static void Conditions(AdventureEditor editorScript, AdventureCreator adventureData)
    {
        adventureData.zx81numberOfConditions_C = editorScript.savedNumberOfConditions_C;

        for (int i = 0; i <= adventureData.zx81numberOfConditions_C; i++)
        {
            adventureData.zx81condition_Cs = editorScript.savedCondition_Cs;
        }
    }
Example #7
0
    // Vocabulary
    private static void Vocabulary(AdventureEditor editorScript, AdventureCreator adventureData)
    {
        adventureData.zx81numberOfWords_V = editorScript.savedNumberOfWords_V;

        for (int i = 0; i <= editorScript.savedNumberOfWords_V; i++)
        {
            adventureData.zx81vocabulary_Vs = editorScript.savedVocabulary_Vs;

            adventureData.zx81actionCode = editorScript.savedActionCode;
        }
    }
Example #8
0
    // Actions
    private void Actions(AdventureCreator myAdventure)
    {
        editorScript.numberOfActions_A = myAdventure.zx81numberOfActions_A;

        editorScript.action_As = new string[editorScript.numberOfActions_A];


        for (int i = 1; i <= editorScript.numberOfActions_A - 1; i++)
        {
            editorScript.action_As = myAdventure.zx81action_As;
        }
    }
Example #9
0
    // Conditions
    private void Conditions(AdventureCreator myAdventure)
    {
        editorScript.numberOfConditions_C = myAdventure.zx81numberOfConditions_C;

        editorScript.condition_Cs = new string[editorScript.numberOfConditions_C];


        for (int i = 1; i <= editorScript.numberOfConditions_C - 1; i++)
        {
            editorScript.condition_Cs = myAdventure.zx81condition_Cs;
        }
    }
Example #10
0
    // Objects
    private static void Objects(AdventureEditor editorScript, AdventureCreator adventureData)
    {
        adventureData.zx81numberOfObjects_O = editorScript.savedNumberOfObjects_O;

        for (int i = 0; i <= adventureData.zx81numberOfObjects_O; i++)
        {
            adventureData.zx81objectDescription_Os = editorScript.savedObjectDescription_Os;

            adventureData.zx81objectLocation_Q = editorScript.savedObjectLocation_Q;

            adventureData.zx81gameObject_O = editorScript.savedGameObject_O;
        }
    }
Example #11
0
    // Rooms
    private static void Rooms(AdventureEditor editorScript, AdventureCreator adventureData)
    {
        adventureData.zx81numberOfRooms_R = editorScript.savedNumberOfRooms_R;

        for (int i = 0; i <= adventureData.zx81numberOfRooms_R; i++)
        {
            adventureData.zx81roomNumber = editorScript.savedRoomNumber;

            adventureData.zx81roomDescription = editorScript.savedRoomDescription;

            adventureData.zx81roomConnection_Ms = editorScript.savedRoomConnection_Ms;
        }
    }
Example #12
0
    // Action Messages
    private static void ActionMessages(AdventureEditor editorScript, AdventureCreator adventureData)
    {
        adventureData.zx81numberOfMessages = editorScript.savedNumberOfMessages;

        for (int i = 0; i <= adventureData.zx81numberOfMessages; i++)
        {
            adventureData.zx81messageNumber = editorScript.savedMessageNumber;

            for (int j = 0; j <= NUMBER_OF_LINES; j++)
            {
                adventureData.zx81actionMessage = editorScript.savedActionMessage;
            }
        }
    }
Example #13
0
    // Vocabulary
    private void Vocabulary(AdventureCreator myAdventure)
    {
        editorScript.numberOfWords_V = myAdventure.zx81numberOfWords_V;

        editorScript.vocabulary_Vs = new string[editorScript.numberOfWords_V];

        editorScript.actionCode = new string[editorScript.numberOfWords_V];


        for (int i = 1; i <= editorScript.numberOfWords_V - 1; i++)
        {
            editorScript.vocabulary_Vs = myAdventure.zx81vocabulary_Vs;

            editorScript.actionCode = myAdventure.zx81actionCode;
        }
    }
Example #14
0
    public void saveData()
    {
        AdventureCreator adventureData = new AdventureCreator();

        // Get file name
        filePath = dataFilePath(editorScript.fileName);


        if (File.Exists(filePath))
        {
            File.Delete(dataFilePath(filePath));
        }

        BinaryFormatter binaryFormatter = new BinaryFormatter();

        FileStream saveDataStream = File.Open(dataFilePath(filePath), FileMode.Create);


        // Adventure name
        adventureData.zx81adventureName_Ns = editorScript.savedAdventureName_Ns;

        // Rooms
        Rooms(editorScript, adventureData);

        // Objects
        Objects(editorScript, adventureData);

        // Vocabulary
        Vocabulary(editorScript, adventureData);

        // Conditions
        Conditions(editorScript, adventureData);

        // Actions
        Actions(editorScript, adventureData);

        // Action messages
        ActionMessages(editorScript, adventureData);


        binaryFormatter.Serialize(saveDataStream, adventureData);

        saveDataStream.Close();
    }
Example #15
0
 private void OnEnable()
 {
     if (AdvGame.GetReferences())
     {
         if (AdvGame.GetReferences().actionsManager)
         {
             actionsManager = AdvGame.GetReferences().actionsManager;
             AdventureCreator.RefreshActions();
         }
         else
         {
             Debug.LogError("An Actions Manager is required - please use the Game Editor window to create one.");
         }
     }
     else
     {
         Debug.LogError("A References file is required - please use the Game Editor window to create one.");
     }
 }
Example #16
0
    public void loadData()
    {
        // Get file path
        filePath = dataFilePath(editorScript.fileName);
        //Debug.Log("Data path from loadData: " + filePath);

        // See if file exists
        if (File.Exists(filePath))
        {
            BinaryFormatter binaryFormatter = new BinaryFormatter();

            // Open the file to read
            FileStream loadDataStream = File.Open(dataFilePath(filePath), FileMode.Open);

            AdventureCreator myAdventure = (AdventureCreator)binaryFormatter.Deserialize(loadDataStream);

            // Close file
            loadDataStream.Close();


            // Adventure name
            editorScript.adventureName_Ns = myAdventure.zx81adventureName_Ns;

            // Rooms
            Rooms(myAdventure);

            // Objects
            Objects(myAdventure);

            // Vocabulary
            Vocabulary(myAdventure);

            // Conditions
            Conditions(myAdventure);

            // Actions
            Actions(myAdventure);

            // Action messages
            ActionMessages(myAdventure);
        }
    }
Example #17
0
    // Objects
    private void Objects(AdventureCreator myAdventure)
    {
        editorScript.numberOfObjects_O = myAdventure.zx81numberOfObjects_O;

        editorScript.objectDescription_Os = new string[editorScript.numberOfObjects_O];

        editorScript.objectLocation_Q = new int[editorScript.numberOfObjects_O];

        editorScript.gameObject_O = new int[editorScript.numberOfObjects_O];


        for (int i = 1; i <= editorScript.numberOfObjects_O - 1; i++)
        {
            editorScript.objectDescription_Os = myAdventure.zx81objectDescription_Os;

            editorScript.objectLocation_Q = myAdventure.zx81objectLocation_Q;

            editorScript.gameObject_O = myAdventure.zx81gameObject_O;
        }
    }
Example #18
0
    // Rooms
    private void Rooms(AdventureCreator myAdventure)
    {
        editorScript.numberOfRooms_R = myAdventure.zx81numberOfRooms_R;

        editorScript.roomDescription = new string[editorScript.numberOfRooms_R, NUMBER_OF_LINES];

        editorScript.roomConnection_Ms = new string[editorScript.numberOfRooms_R];

        editorScript.temporaryRoomArray = new string[editorScript.numberOfRooms_R];


        for (int i = 1; i <= editorScript.numberOfRooms_R - 1; i++)
        {
            editorScript.roomConnection_Ms = myAdventure.zx81roomConnection_Ms;
            //print("i = " + i + ", roomConnection_Ms: " + editorScript.roomConnection_Ms[i]);
        }

        for (int i = 0; i <= (editorScript.numberOfRooms_R - 1) * NUMBER_OF_LINES; i++)
        {
            editorScript.temporaryRoomArray = myAdventure.zx81roomDescription;
            //print("i = " + i + ", Temporary array: " + editorScript.temporaryRoomArray[i]);
        }

        // Room description index
        int k = 0;

        for (int i = 1; i <= editorScript.numberOfRooms_R - 1; i++)
        {
            for (int j = k; j <= (NUMBER_OF_LINES - 1) + k; j++)
            {
                editorScript.roomDescription[i, (j - k)] = editorScript.temporaryRoomArray[j];
                //print("k = " + k + ", i = " + i + ", j = " + j + ", (j - k) = " + (j - k) + ", Room description: " + editorScript.roomDescription[i, ( j - k )]);
            }

            k = k + NUMBER_OF_LINES;
        }
    }