Exemplo n.º 1
0
        private static void DoWork()
        {
            var processedPosts = new List <StereoImage>();
            var files          = GetPairs(@"C:\Users\amadeusz\Pictures\Stereo\out\").ToArray();

            for (int i = 0; i < files.Length; i += 2)
            {
                var file1 = files[i];     // Right eye view
                var file2 = files[i + 1]; // Left eye view
                var name  = Path.GetFileNameWithoutExtension(file1);
                if (name.EndsWith(".L") || name.EndsWith(".R"))
                {
                    name = name.Substring(0, name.Length - 2);
                }
                processedPosts.Add(ProcessPair(file1, file2, name));
            }

            using (StreamWriter file = File.CreateText(Path.Combine(SaveLocation, PostsFile)))
            {
                var serializer = new JsonSerializer();
                var collection = new SceneCollection()
                {
                    scenes = processedPosts
                };
                serializer.Serialize(file, collection);
            }
        }
Exemplo n.º 2
0
    /// <summary>
    /// Converts scene name into position
    /// </summary>
    /// <param name="sceneName">Scene name.</param>
    /// <param name="posX">Position x.</param>
    /// <param name="posY">Position y.</param>
    /// <param name="posZ">Position z.</param>
    public static void SceneNameToPos(SceneCollection sceneCollection, string sceneName, out int posX, out int posY, out int posZ)
    {
        posX = 0;
        posY = 0;
        posZ = 0;

        string[] values = sceneName.Replace(sceneCollection.prefixScene, "").Replace(".unity", "").Split(new char[] {
            '_'
        }, System.StringSplitOptions.RemoveEmptyEntries);

        foreach (var item in values)
        {
            if (item [0] == 'x')
            {
                posX = int.Parse(item.Replace("x", ""));
            }
            if (item [0] == 'y')
            {
                posY = int.Parse(item.Replace("y", ""));
            }
            if (item [0] == 'z')
            {
                posZ = int.Parse(item.Replace("z", ""));
            }
        }
    }
Exemplo n.º 3
0
    IEnumerator LoadLevel(SceneCollection sceneCollection)
    {
        yield return(SceneManager.LoadSceneAsync(sceneCollection.MainSceneName));

        foreach (var additiveScene in sceneCollection.AdditiveScenes)
        {
            var scene = SceneManager.GetSceneByName(additiveScene);
            if (scene == null)
            {
                print("Scene is null");
                continue;
            }

            if (scene.isLoaded)
            {
                print("Scene is loaded");
                yield return(SceneManager.UnloadSceneAsync(scene));

                continue;
            }

            print("Loading scene");
            yield return(SceneManager.LoadSceneAsync(additiveScene, LoadSceneMode.Additive));
        }

        Destroy(this.gameObject);
    }
Exemplo n.º 4
0
 public static void SceneNameToPos(SceneCollection sceneCollection, string sceneName, out int posX, out int posY, out int posZ)
 {
     posX = 0;
     posY = 0;
     posZ = 0;
     string[] array = sceneName.Replace(sceneCollection.prefixScene, string.Empty).Replace(".unity", string.Empty).Split(new char[]
     {
         '_'
     }, StringSplitOptions.RemoveEmptyEntries);
     foreach (string text in array)
     {
         if (text[0] == 'x')
         {
             posX = int.Parse(text.Replace("x", string.Empty));
         }
         if (text[0] == 'y')
         {
             posY = int.Parse(text.Replace("y", string.Empty));
         }
         if (text[0] == 'z')
         {
             posZ = int.Parse(text.Replace("z", string.Empty));
         }
     }
 }
Exemplo n.º 5
0
    /// <summary>
    /// Gets the ID of tile by position.
    /// </summary>
    /// <returns>The ID of tile.</returns>
    /// <param name="position">Position of tile.</param>
    /// <param name="position">Position of tile.</param>
    /// <param name="layer">Layer.</param>
    string GetID(Vector3 position, SceneCollection layer)
    {
        int xId = (int)(Mathf.FloorToInt(position.x / layer.xSize));

        if (Mathf.Abs((position.x / layer.xSize) - Mathf.RoundToInt(position.x / layer.xSize)) < 0.001f)
        {
            xId = (int)Mathf.RoundToInt(position.x / layer.xSize);
        }


        int yId = (int)(Mathf.FloorToInt(position.y / layer.ySize));

        if (Mathf.Abs((position.y / layer.ySize) - Mathf.RoundToInt(position.y / layer.ySize)) < 0.001f)
        {
            yId = (int)Mathf.RoundToInt(position.y / layer.ySize);
        }

        int zId = (int)(Mathf.FloorToInt(position.z / layer.zSize));

        if (Mathf.Abs((position.z / layer.zSize) - Mathf.RoundToInt(position.z / layer.zSize)) < 0.001f)
        {
            zId = (int)Mathf.RoundToInt(position.z / layer.zSize);
        }


        return((layer.xSplitIs ? "_x" + xId : "") +
               (layer.ySplitIs ? "_y" + yId : "")
               + (layer.zSplitIs ? "_z" + zId : ""));
    }
Exemplo n.º 6
0
    /// <summary>
    /// Clears the scene Game objects.
    /// </summary>
    void ClearSceneGO(SceneCollection layer)
    {
        List <string> toRemove = new List <string> ();

        foreach (var item in splits[layer.layerNumber])
        {
            if (item.Value.GetComponent <SceneSplitManager> ())
            {
                Transform splitTrans = item.Value.transform;
                foreach (Transform splitChild in splitTrans)
                {
                    splitChild.parent = null;
                }

                while (splitTrans.childCount > 0)
                {
                    foreach (Transform splitChild in splitTrans)
                    {
                        splitChild.parent = null;
                    }
                }
                GameObject.DestroyImmediate(splitTrans.gameObject);
                toRemove.Add(item.Key);
            }
        }
        foreach (var item in toRemove)
        {
            splits [layer.layerNumber].Remove(item);
        }
    }
        private async Task FetchScenes()
        {
            var rnd = new Random();

            string scenesPath = @"C:\Users\fnkta\Documents\Scenes";

            points = new List <Point>()
            {
                new Point(3500, 3500, 20),
                new Point(3750, 3750, 20),
                new Point(5000, 5000, 20),
            };

            var scenes = await _dataService.GetScenesAsync(scenesPath, points);

            Scenes = new SceneCollection();

            foreach (var scene in scenes)
            {
                var mappedScene = _mapper.Map <Model.Scene>(scene);

                await Task.Run(async() => await Task.Delay(TimeSpan.FromSeconds(rnd.Next(1, 4))));

                Scenes.Add(mappedScene);
            }

            //FillTimeLine();

            //await _dbService.InsertSceneRangeAsync(Scenes.ToList());
        }
    void OnGUI()
    {
        GUILayout.Box("To save the current Scene set up in the Hierarchy as a Scene Collection, enter a name below and click the Save Scene Collection button.");

        EditorGUILayout.Space();

        _newCollectionName = EditorGUILayout.TextField("Name", _newCollectionName);

        if (GUILayout.Button("Save Scene Collection"))
        {
            if (!AssetDatabase.LoadAssetAtPath <ScriptableObject>("Assets/SceneCollections/" + _newCollectionName + ".asset") ||
                EditorUtility.DisplayDialog("Warning", "A Scene collection by that name already exists. Do you want to overwrite it?", "Yes", "Cancel"))
            {
                SceneSetup[] setups = EditorSceneManager.GetSceneManagerSetup();
                if (_newCollectionName.Equals(""))
                {
                    _newCollectionName = "New Scene Collection";
                }
                SceneCollection collection = Create(_newCollectionName, setups);
            }
        }

        EditorGUILayout.Space();

        GUILayout.Box("Scene Collection assets are saved in Assets/SceneCollections. To load a Scene Collection, open the asset by double clicking it in the Project view, like you would a normal Scene.");
    }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scene"/> class.
        /// </summary>
        public Scene()
        {
            Id       = Guid.NewGuid();
            Entities = new EntityCollection(this);

            Children = new SceneCollection(this);
        }
Exemplo n.º 10
0
    /// <summary>
    /// Gets the split position.
    /// </summary>
    /// <returns>The split position.</returns>
    /// <param name="position">Position of tile.</param>
    /// <param name="layer">Layer.</param>
    Vector3 GetSplitPosition(Vector3 position, SceneCollection layer)
    {
        int x = (int)(Mathf.FloorToInt(position.x / layer.xSize));

        if (Mathf.Abs((position.x / layer.xSize) - Mathf.RoundToInt(position.x / layer.xSize)) < 0.001f)
        {
            x = (int)Mathf.RoundToInt(position.x / layer.xSize);
        }


        int y = (int)(Mathf.FloorToInt(position.y / layer.ySize));

        if (Mathf.Abs((position.y / layer.ySize) - Mathf.RoundToInt(position.y / layer.ySize)) < 0.001f)
        {
            y = (int)Mathf.RoundToInt(position.y / layer.ySize);
        }

        int z = (int)(Mathf.FloorToInt(position.z / layer.zSize));

        if (Mathf.Abs((position.z / layer.zSize) - Mathf.RoundToInt(position.z / layer.zSize)) < 0.001f)
        {
            z = (int)Mathf.RoundToInt(position.z / layer.zSize);
        }


        return(new Vector3(x * layer.xSize, y * layer.ySize, z * layer.zSize));
    }
Exemplo n.º 11
0
    /// <summary>
    /// Adds the scenes to build.
    /// </summary>
    void AddScenesToBuild(SceneCollection sceneCollection)
    {
        List <EditorBuildSettingsScene> scenesList = new List <EditorBuildSettingsScene> ();

        scenesList.AddRange(EditorBuildSettings.scenes);

        List <string> scenesToAdd = new List <string> ();

        scenesToAdd.AddRange(sceneCollection.names);

        foreach (var item in scenesList)
        {
            if (scenesToAdd.Contains(item.path.Replace(sceneCollection.path, "")))
            {
                scenesToAdd.Remove(item.path.Replace(sceneCollection.path, ""));
            }
        }

        foreach (var item in scenesToAdd)
        {
            scenesList.Add(new EditorBuildSettingsScene(sceneCollection.path + item, true));
        }

        EditorBuildSettings.scenes = scenesList.ToArray();
    }
Exemplo n.º 12
0
        private void GoToNextLevel()
        {
            if (NetworkServer.active && !SceneExitController.isRunning)
            {
                SceneCollection startingScenes = initialStartingScenes;
                if (startingScenes == null || startingScenes.isEmpty)
                {
                    startingScenes = ScriptableObject.CreateInstance <SceneCollection>();
                    startingScenes.SetSceneEntries(new SceneCollection.SceneEntry[] {
                        new SceneCollection.SceneEntry {
                            sceneDef = SceneCatalog.GetSceneDefFromSceneName("blackbeach"),
                            weight   = 1,
                        },
                        new SceneCollection.SceneEntry {
                            sceneDef = SceneCatalog.GetSceneDefFromSceneName("golemplains"),
                            weight   = 1,
                        },
                    });
                }

                WeightedSelection <SceneDef> sceneDefs = new WeightedSelection <SceneDef>();
                startingScenes.AddToWeightedSelection(sceneDefs);
                run.PickNextStageScene(sceneDefs);
                SceneExitController exitController = gameObject.AddComponent <SceneExitController>();
                exitController.useRunNextStageScene = true;
                Debug.Log("Advancing to next stage...");
                exitController.Begin();
            }
        }
Exemplo n.º 13
0
        protected void Awake()
        {
            run = GetComponent <Run>();
            initialStartingScenes = run.startingSceneGroup;
            //run.startingSceneGroup = ScriptableObject.CreateInstance<SceneCollection>();
            //run.startingSceneGroup.SetSceneEntries(new SceneCollection.SceneEntry[] {
            //    new SceneCollection.SceneEntry {
            //        sceneDef = SceneCatalog.GetSceneDefFromSceneName("limbo"),
            //        weight = 1,
            //    },
            //});

            allySquad = gameObject.AddComponent <CombatSquad>();
            allySquad.onMemberLost += AllySquad_onMemberLost;
            allies = new List <CharacterMaster>();

            On.RoR2.Run.PickNextStageScene += Run_ForceVIPScene;

            IL.RoR2.TeamComponent.SetupIndicator += TeamComponent_SetupIndicator;

            Stage.onStageStartGlobal      += Stage_onStageStartGlobal;
            Run.onServerGameOver          += Run_onServerGameOver;
            On.RoR2.Run.OnServerBossAdded += Run_OnServerBossAdded;
            On.RoR2.RunReport.Generate    += RunReport_Generate;
            On.RoR2.BarrelInteraction.OnInteractionBegin += BarrelInteraction_OnInteractionBegin;
        }
Exemplo n.º 14
0
        public override SceneCollection Load()
        {
            var collection = new SceneCollection();

            LoadShaders(collection);
            LoadMainCameras(collection);

            var map = LoadMap();

            map.Scale = new Vector3(10, 10, 10);
            collection.SceneObjects.ComplexObjects.Add(map);

            var redCar = LoadRedCar();

            redCar.Name     = "RedCar";
            redCar.Position = new Vector3(0, 0, 4.3f);
            redCar.Rotation = new Vector3(0, -(float)Math.PI / 2, 0);
            collection.SceneObjects.ComplexObjects.Add(redCar);

            var greenCar = LoadGreenCar();

            greenCar.Name     = "GreenCar";
            greenCar.Position = new Vector3(0, 0, 5.3f);
            greenCar.Rotation = new Vector3(0, -(float)Math.PI / 2, 0);
            collection.SceneObjects.ComplexObjects.Add(greenCar);

            var light = LoadSunLight();

            collection.SceneObjects.Lights.Add(light);


            return(collection);
        }
Exemplo n.º 15
0
 private void LoadShaders(SceneCollection collection)
 {
     collection.Shaders.Add("phong_phong", new ShaderProgram("Graphics\\Resources\\Shaders\\ready\\vs_phong.c", "Graphics\\Resources\\Shaders\\ready\\fs_phong_phong.c", true));
     collection.Shaders.Add("phong_blinn", new ShaderProgram("Graphics\\Resources\\Shaders\\ready\\vs_phong.c", "Graphics\\Resources\\Shaders\\ready\\fs_phong_blinn.c", true));
     collection.Shaders.Add("gouraud_phong", new ShaderProgram("Graphics\\Resources\\Shaders\\ready\\vs_gouraud_phong.c", "Graphics\\Resources\\Shaders\\ready\\fs_gouraud.c", true));
     collection.Shaders.Add("gouraud_blinn", new ShaderProgram("Graphics\\Resources\\Shaders\\ready\\vs_gouraud_blinn.c", "Graphics\\Resources\\Shaders\\ready\\fs_gouraud.c", true));
     collection.ActiveShader = "phong_phong";
 }
Exemplo n.º 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SceneManager"/> class.
        /// </summary>
        /// <param name="game">
        /// The game.
        /// </param>
        public static void Construct(Game game)
        {
            Z_POSITION       = -10.0f;
            LIGHT_Z_POSITION = -1.0f;
            scenes           = new SceneCollection();

            SceneManager.game = game;
        }
Exemplo n.º 17
0
    /// <summary>
    /// Clears the split scene.
    /// </summary>
    void ClearSplitScene(SceneCollection layer)
    {
        warning = "";
        splits [layer.layerNumber] = new Dictionary <string, GameObject> ();

        GameObject[] allObjects = UnityEngine.Object.FindObjectsOfType <GameObject> ();

        FindSceneGO(layer.prefixScene, allObjects, splits [layer.layerNumber]);
        ClearSceneGO(layer);
    }
Exemplo n.º 18
0
 /// <summary>
 /// Generates the random scene objects.
 /// </summary>
 void GenerateRandomSceneObjects(SceneCollection layer)
 {
     warning = "";
     for (int i = 0; i < 100; i++)
     {
         GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
         cube.transform.position = Random.insideUnitSphere * 100;
         cube.name = layer.prefixName + "_" + i;
     }
 }
Exemplo n.º 19
0
        public void Load(string sceneName)
        {
            SceneModel scene = SceneCollection.GetSceneByName(sceneName);

            if (scene == null || IsSceneLoaded(scene.Scene))
            {
                return;
            }

            StartCoroutine(LoadRouting(scene));
        }
Exemplo n.º 20
0
        private static async Task MainAsync()
        {
            Console.WriteLine("Do you want to download new posts? (y, enter)");
            IEnumerable <StereoImage> posts = null;

            if (Console.ReadLine().ToLowerInvariant() == "y")
            {
                Console.WriteLine("Downloading data from Reddit...");
                posts = await GetPosts();

                Console.WriteLine("Fetching image URLs...");
                posts = await GetImageUrls(posts);

                Console.WriteLine("Writing data to disk...");
                using (StreamWriter file = File.CreateText(Path.Combine(DownloadLocation, PostsFile)))
                {
                    var serializer = new JsonSerializer();
                    var collection = new SceneCollection()
                    {
                        scenes = posts
                    };
                    serializer.Serialize(file, collection);
                }
            }
            else
            {
                Console.WriteLine("Reading data from disk...");
                using (StreamReader file = File.OpenText(Path.Combine(DownloadLocation, PostsFile)))
                {
                    var serializer = new JsonSerializer();
                    var collection = (SceneCollection)serializer.Deserialize(file, typeof(SceneCollection));
                    posts = collection.scenes;
                }
            }

            //Console.WriteLine("Do you want to process images? (y, enter)");
            //if (Console.ReadLine().ToLowerInvariant() == "y")
            {
                var processedPosts = await DoWork(posts);

                using (StreamWriter file = File.CreateText(Path.Combine(SaveLocation, PostsFile)))
                {
                    var serializer = new JsonSerializer();
                    var collection = new SceneCollection()
                    {
                        scenes = processedPosts
                    };
                    serializer.Serialize(file, collection);
                }
            }

            Console.WriteLine("All done. Hit Enter to exit.");
            Console.ReadLine();
        }
Exemplo n.º 21
0
    /// <summary>
    /// Creates the layer.
    /// </summary>
    void CreateLayer()
    {
        GameObject sceneCollectionGO = new GameObject("SC_" + sceneLayers.Count);

        sceneCollectionGO.transform.parent = sceneSplitterSettings.transform;

        SceneCollection newSceneCollection = sceneCollectionGO.AddComponent <SceneCollection> ();

        newSceneCollection.color = new Color(Random.value, Random.value, Random.value, 255);
        sceneLayers.Add(newSceneCollection);
        splits.Add(new Dictionary <string, GameObject> ());
    }
Exemplo n.º 22
0
        private static async Task MainAsync()
        {
            var flickr = new Flickr();

            Console.WriteLine("Do you want to download new posts? (y, enter)");
            IEnumerable <StereoImage> posts = null;

            if (Console.ReadLine().ToLowerInvariant() == "y")
            {
                Console.WriteLine("Fetching image URLs...");

                // 3D Insects in Flight 2015 by Franz
                posts = await flickr.ScrapeAlbum("24851601@N02", "72157648972433403", "fotoopa_hs");

                Console.WriteLine("Writing data to disk...");
                Directory.CreateDirectory(DownloadLocation);
                using (StreamWriter file = File.CreateText(Path.Combine(DownloadLocation, PostsFile)))
                {
                    var serializer = new JsonSerializer();
                    var collection = new SceneCollection()
                    {
                        scenes = posts
                    };
                    serializer.Serialize(file, collection);
                }
            }
            else
            {
                Console.WriteLine("Reading data from disk...");
                using (StreamReader file = File.OpenText(Path.Combine(DownloadLocation, PostsFile)))
                {
                    var serializer = new JsonSerializer();
                    var collection = (SceneCollection)serializer.Deserialize(file, typeof(SceneCollection));
                    posts = collection.scenes;
                }
            }

            Directory.CreateDirectory(SaveLocation);
            var processedPosts = await DoWork(posts);

            using (StreamWriter file = File.CreateText(Path.Combine(SaveLocation, PostsFile)))
            {
                var serializer = new JsonSerializer();
                var collection = new SceneCollection()
                {
                    scenes = processedPosts
                };
                serializer.Serialize(file, collection);
            }

            Console.WriteLine("All done. Hit Enter to exit.");
            Console.ReadLine();
        }
Exemplo n.º 23
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Streamer myTarget = (Streamer)target;

        if (myTarget.sceneCollection == null)
        {
            EditorGUILayout.HelpBox("Add scene collection", MessageType.Error, true);
        }
        else if (myTarget.sceneCollection != null)
        {
            SceneCollection currentCollection = myTarget.sceneCollection;

            List <EditorBuildSettingsScene> scenesList = new List <EditorBuildSettingsScene> ();
            scenesList.AddRange(EditorBuildSettings.scenes);

            List <string> scenesToAdd = new List <string> ();
            scenesToAdd.AddRange(currentCollection.names);

            foreach (var item in scenesList)
            {
                if (scenesToAdd.Contains(item.path.Replace(currentCollection.path, "")))
                {
                    scenesToAdd.Remove(item.path.Replace(currentCollection.path, ""));
                }
            }

            if (scenesToAdd.Count > 0)
            {
                EditorGUILayout.HelpBox("Add scenes from scene collection to build settings.", MessageType.Error, true);
                if (GUILayout.Button("Add scenes to build settings"))
                {
                    AddScenesToBuild(currentCollection);
                }
            }

            if (myTarget.tag != Streamer.STREAMERTAG)
            {
                EditorGUILayout.HelpBox("Streamer must have " + Streamer.STREAMERTAG + " Tag.", MessageType.Error, true);
                if (GUILayout.Button("Change tag"))
                {
                    myTarget.tag = Streamer.STREAMERTAG;
                }
            }

            if (myTarget.deloadingRange.x < myTarget.loadingRange.x || myTarget.deloadingRange.y < myTarget.loadingRange.y || myTarget.deloadingRange.z < myTarget.loadingRange.z)
            {
                EditorGUILayout.HelpBox("Streamer deloading range must >= loading range", MessageType.Error, true);
            }
        }
    }
Exemplo n.º 24
0
    public static SceneCollection Create(string name, SceneSetup[] setups)
    {
        SceneCollection collection = ScriptableObject.CreateInstance <SceneCollection>();

        collection.name   = name;
        collection.setups = setups;
        if (!AssetDatabase.IsValidFolder("Assets/SceneCollections"))
        {
            AssetDatabase.CreateFolder("Assets", "SceneCollections");
        }
        AssetDatabase.CreateAsset(collection, "Assets/SceneCollections/" + name + ".asset");
        return(collection);
    }
Exemplo n.º 25
0
        void CreateScenes()
        {
            scenes = new SceneCollection();

            //game scene
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, vDims.X, vDims.Y), "game"));
            //menu scene
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, vDims.X, vDims.Y), "menu"));
            //overlay
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, vDims.X, vDims.Y), "overlay"));
            //base
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, vDims.X, vDims.Y), new Rectangle(0, 0, vDims.X, vDims.Y), new Rectangle(0, 0, wDims.X, wDims.Y), "base"));
        } //explicit name
Exemplo n.º 26
0
        protected override void Initialize()
        {
            transitionTimer = new Timer(2f);
            ipp             = new InputProfile(new KeyManager[]
            {
                new KeyManager(Keys.Right, "right"),
                new KeyManager(Keys.Left, "left"),
                new KeyManager(Keys.R, "restart"),
            });

            inputProfile   = new InputProfile(new KeyManager[] { new KeyManager(Keys.Left, "playerLeft"), new KeyManager(Keys.Right, "playerRight"), new KeyManager(Keys.Up, "playerUp"), new KeyManager(Keys.Down, "playerDown") });
            phase          = GamePhase.Menu;
            mouseMan       = new CursorManager();
            IsMouseVisible = false;
            EntityCollection.CreateGroup("turret", "turrets");
            EntityCollection.CreateGroup("rock", "rocks");
            EntityCollection.CreateGroup("enemy", "enemies");
            EntityCollection.CreateGroup("bgElement", "bgElements");
            EntityCollection.CreateGroup(new Property("isEnt", "isEnt", "isEnt"), "entities");
            virtualDims = new Point(400, 272);

            TDdims = new Point(240, 240);
            TAdims = new Point(160, 272);

            TDFrame = new Rectangle(0, 0, TDdims.X, TDdims.Y);
            TAFrame = new Rectangle(240, 0, TAdims.X, TAdims.Y);

            scenes = new SceneCollection();
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, TAdims.X, TAdims.Y), "text"));
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, virtualDims.X, virtualDims.Y), "menu"));
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, TDdims.X, TDdims.Y), "td"));
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, virtualDims.X, virtualDims.Y), "game"));
            scenes.scenes.Add(new Scene(new RenderTarget2D(GraphicsDevice, TDdims.X, virtualDims.Y - TDdims.Y), "status"));

            eventNb = 0;
            XDocument xdoc = XDocument.Load("Content\\eventStuff.xml");
            XElement  el;

            do
            {
                el = xdoc.Root.Element("EventQueue" + eventNb.ToString());
                eventNb++;
            } while (el != null);
            eventNb--;

            waitingEventQueueNbs = new List <int>();

            base.Initialize();

            waveTimer = new Timer(15);
        }
Exemplo n.º 27
0
    /// <summary>
    /// Finds the collections.
    /// </summary>
    public void FindCollection(SceneCollection layer)
    {
        string     scenesPath = this.sceneSplitterSettings.scenesPath + layer.prefixScene + "/";
        GameObject prefab     = (GameObject)AssetDatabase.LoadAssetAtPath(scenesPath + "SC_" + layer.prefixScene + ".prefab", typeof(GameObject));

        if (prefab != null)
        {
            SceneCollection sceneCollection = prefab.GetComponent <SceneCollection> ();
            if (!currentCollections.Contains(sceneCollection))
            {
                currentCollections.Add(sceneCollection);
            }
            listSizeCollections = currentCollections.Count;
        }
    }
Exemplo n.º 28
0
        private void ProgressMovie(SceneCollection collection, float deltaTime)
        {
            if (_isRaceAnimated)
            {
                var complexObjects = collection.SceneObjects.GetComplexObjectsWiThGlobalModelMatrices();
                var redCar         = complexObjects.FirstOrDefault(x => x.Object.Name == "RedCar").Object;
                var greenCar       = complexObjects.FirstOrDefault(x => x.Object.Name == "GreenCar").Object;

                var redRadius   = 4.3f;
                var greenRadius = 5.3f;

                if (_isMovieMode && _delay >= 0)
                {
                    SetCarPosition(redCar, redRadius, _redDistance);
                    SetCarPosition(greenCar, greenRadius, _greenDistance);
                    _delay -= deltaTime;
                }
                else
                {
                    _redVelocity   = SetCarVelocity(redRadius, _redDistance);
                    _greenVelocity = SetCarVelocity(greenRadius, _greenDistance) * _greenMultipleFactor;


                    RandomizeVelocity(redRadius, _redDistance, ref _redVelocityChanges);
                    _redVelocity *= _redVelocityChanges;
                    RandomizeVelocity(greenRadius, _greenDistance, ref _greenVelocityChanges);
                    _greenVelocity *= _greenVelocityChanges;

                    _redDistance   += deltaTime * _redVelocity;
                    _greenDistance += deltaTime * _greenVelocity;

                    SetCarPosition(redCar, redRadius, _redDistance);
                    SetCarPosition(greenCar, greenRadius, _greenDistance);
                }


                if (_isMovieMode)
                {
                    collection.ActiveCamera = collection.SceneObjects.GetCamerasWiThGlobalModelMatrices().FirstOrDefault(x => x.Object.Name == "MovieCamera");
                    if (collection.ActiveCamera != null)
                    {
                        AnimateCameras(collection.ActiveCamera.Object, redCar, greenCar, redRadius);
                    }
                }
            }
        }
Exemplo n.º 29
0
    //-------------------------------------------------
    #region Deserialize method

    public static bool Deserialize(string data)
    {
        StringReader  reader = null;
        XmlSerializer xmls   = new XmlSerializer(typeof(SceneCollection));

        try {
            reader     = new StringReader(data);
            collection = xmls.Deserialize(reader) as SceneCollection;
        }
        catch (Exception e) {
            Debug.LogError("Something went horribly wrong: \n" + e.ToString());
            return(false);
        }
        finally {
            reader.Dispose();
        }

        return(true);
    }
Exemplo n.º 30
0
        private void LoadMainCameras(SceneCollection collection)
        {
            Camera staticCam = new Camera();

            staticCam.Name     = "StaticCamera";
            staticCam.Position = new Vector3(0, 8f, 8);
            staticCam.Rotation = new Vector3((float)Math.PI / 4, (float)Math.PI, 0);
            collection.SceneObjects.Cameras.Add(staticCam);

            Camera dynamicCam = new Camera();

            dynamicCam.Name      = "DynamicCamera";
            dynamicCam.Position  = new Vector3(0, 5f, 0);
            dynamicCam.Rotation  = new Vector3(-(float)Math.PI / 4, (float)Math.PI, 0);
            dynamicCam.Rotation += new Vector3((float)Math.PI / 4, 0, 0);
            collection.SceneObjects.Cameras.Add(dynamicCam);

            Camera movieCamera = new Camera();

            movieCamera.Name = "MovieCamera";
            collection.SceneObjects.Cameras.Add(movieCamera);

            collection.ActiveCamera = collection.SceneObjects.GetCamerasWiThGlobalModelMatrices().First(x => x.Object.Name == "StaticCamera");
        }
    public static bool Deserialize(string data)
    {
        StringReader reader = null;
        XmlSerializer xmls = new XmlSerializer(typeof(SceneCollection));

        try {
            reader = new StringReader(data);
            collection = xmls.Deserialize(reader) as SceneCollection;
        }
        catch(Exception e) {
            Debug.LogError("Something went horribly wrong: \n" + e.ToString());
            return false;
        }
        finally {
            reader.Dispose();
        }

        return true;
    }