Exemple #1
0
    public AuroraGIT CreateGIT()
    {
        AuroraGIT git = new AuroraGIT();

        // Use field metadata from the Metadata Editor
        git.UseTemplates   = AuroraEngine.Resources.data.module.git.UseTemplates;
        git.KTGameVerIndex = AuroraEngine.Resources.data.module.git.KTGameVerIndex;
        git.KTInfoDate     = AuroraEngine.Resources.data.module.git.KTInfoDate;
        git.KTInfoVersion  = AuroraEngine.Resources.data.module.git.KTInfoVersion;

        // Use the AreaProperties from the Metadata Editor
        git.AreaProperties = AuroraEngine.Resources.data.module.git.AreaProperties;

        foreach (Transform parent in transform)
        {
            // Ignore the models parent
            if (parent.name == "Models")
            {
                continue;
            }

            foreach (Transform instance in parent)
            {
                AuroraInstance aInstance = instance.GetComponent <AuroraInstance>();

                aInstance.BuildGIT(git);
            }
        }

        return(git);
    }
Exemple #2
0
    void SaveGIT()
    {
        string    filename = EditorUtility.SaveFilePanel("Save a new GIT file", "", "", "");
        AuroraGIT git      = GameObject.Find("Area").GetComponent <AreaManager>().CreateGIT();
        string    no_ext   = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename));

        KModuleEditor.CreateGFFFile(no_ext, "", git, "git");
    }
    public void BuildGIT(AuroraGIT git)
    {
        // Update the GIT with information on this
        switch (transform.parent.name)
        {
        case "Creatures":
            AuroraGIT.ACreature creature = (AuroraGIT.ACreature)gitData;
            creature.structid = 4;
            git.CreatureList.Add(creature);
            break;

        case "Placeables":
            AuroraGIT.APlaceable placeable = (AuroraGIT.APlaceable)gitData;
            placeable.structid = 9;
            git.PlaceableList.Add(placeable);
            break;

        case "Doors":
            AuroraGIT.ADoor door = (AuroraGIT.ADoor)gitData;
            door.structid = 8;
            git.DoorList.Add(door);
            break;

        case "Triggers":
            AuroraGIT.ATrigger trigger = (AuroraGIT.ATrigger)gitData;
            trigger.structid = 1;
            git.TriggerList.Add(trigger);
            break;

        case "Encounters":
            AuroraGIT.AEncounter encounter = (AuroraGIT.AEncounter)gitData;
            encounter.structid = 7;
            git.EncounterList.Add(encounter);
            break;

        case "Sounds":
            AuroraGIT.ASound sound = (AuroraGIT.ASound)gitData;
            sound.structid = 6;
            git.SoundList.Add(sound);
            break;

        case "Stores":
            AuroraGIT.AStore store = (AuroraGIT.AStore)gitData;
            store.structid = 11;
            git.StoreList.Add(store);
            break;

        case "Waypoints":
            AuroraGIT.AWaypoint waypoint = (AuroraGIT.AWaypoint)gitData;
            waypoint.structid = 5;
            git.WaypointList.Add(waypoint);
            break;

        case "Cameras":
            AuroraGIT.ACamera cam = (AuroraGIT.ACamera)gitData;
            cam.structid = 14;
            git.CameraList.Add(cam);
            break;

        default:
            throw new System.Exception("Unknown parent " + transform.parent.name + " found.");
        }
    }
Exemple #4
0
        public Module(string name, AuroraData data, bool instantiateModule)
        {
            this.moduleName = name;
            this.data       = data;

            if (!instantiateModule)
            {
                return;
            }

            if (stateManager == null)
            {
                stateManager = GameObject.Find("State System").GetComponent <StateSystem>();
            }
            if (loader == null)
            {
                loader = GameObject.Find("Loading System").GetComponent <LoadingSystem>();
            }

            ifo = data.Get <AuroraIFO>("module", ResourceType.IFO);
            Debug.Log(ifo);
            string areaName = ifo.Mod_Entry_Area;

            are = data.Get <AuroraARE>(areaName, ResourceType.ARE);
            git = data.Get <AuroraGIT>(areaName, ResourceType.GIT);

            entryPosition = new Vector3(ifo.Mod_Entry_X, ifo.Mod_Entry_Z, ifo.Mod_Entry_Y);

            Dictionary <string, Vector3> layout = Resources.LoadLayout(areaName, data);

            Debug.Log("Layout has " + layout.Count + " rooms.");

            area = Area.Create(are);

            GameObject parent = new GameObject("Models");

            parent.transform.SetParent(area.transform);

            foreach (var value in layout)
            {
                loader.AddAction(() =>
                {
                    Debug.Log("Loading room " + value.Key);
                    string resref = value.Key.ToLower();

                    GameObject room = Resources.LoadModel(resref);

                    if (SetupSkybox(room))
                    {
                        return;
                    }

                    // Set up the Navmesh
                    SetLayerRecursive(room, LayerMask.NameToLayer("NavMeshStatic"));

                    // Set the room's position and parent
                    room.transform.position = value.Value;
                    room.transform.SetParent(parent.transform);
                });
            }

            LoadCreatures();
            LoadPlaceables();

            loader.AddAction(() => data.aiManager.BakeNavMesh());

            LoadDoors();
            LoadTriggers();
            LoadEncounters();
            LoadSounds();
            LoadStores();
            LoadWaypoints();
            LoadCameras();

            loader.AddAction(() =>
            {
                // Load the music
                //int musicId = git.AreaProperties.MusicDay;
                //string musicResource = Resources.Load2DA("ambientmusic")[musicId, "resource"];

                //ambientMusic = Resources.LoadAudio(musicResource);
            });
        }