public override FILEERROR Save(BaseSceneSaver node, Filename name, BaseDocument doc, SCENEFILTER filterflags)
        {
            BaseDocument polyDoc = doc.Polygonize();

            Logger.Debug("Fuseefy Me!");

            SceneContainer root = new SceneContainer()
            {
                Header = new SceneHeader()
                {
                    CreatedBy = "",
                    Generator = "FUSEE Export Plugin for Cinema4D",
                    Version = 1
                },
                Children = FuseefyOb(polyDoc.GetFirstObject())
            };

            var ser = new Serializer();
            using (var file = File.Create(name.GetString()))
            {
                ser.Serialize(file, root);
            }

            return FILEERROR.FILEERROR_NONE;
        }
 public SceneRenderer(SceneContainer sc, string scenePathDirectory)
 {
     // Todo: scan for lights...
     _lights = new List<LightInfo>();
     _sc = sc;
     _scenePathDirectory = scenePathDirectory;
 }
Esempio n. 3
0
 public SceneObject(SceneContainer scene)
 {
     this.model = scene;
     parseModel();
 }
Esempio n. 4
0
        public override void Init()
        {
            #region LevelInit
            var seri = new Serializer();
            using (var fileLevel = File.OpenRead(@"Assets/blume_blau.fus"))
            {
                _levelSC = seri.Deserialize(fileLevel, null, typeof(SceneContainer)) as SceneContainer;
            }
            _levelSR = new SceneRenderer(_levelSC, "Assets");
            _levelSOC = FindByName("blaetter", _levelSC.Children);
            #endregion
            #region PlayerInit
            using (var filePlayer = File.OpenRead(@"Assets/blume_blau.fus"))
            {
                _playerSC = seri.Deserialize(filePlayer, null, typeof(SceneContainer)) as SceneContainer;
            }
            _playerSR = new SceneRenderer(_playerSC, "Assets");
            _playerSOC = FindByName("blume_blau_container", _playerSC.Children);
            _playerSOC.Transform.Scale = _playerSOC.Transform.Scale / 6;
            #endregion
            //more GUI stuff
            _guiRender = new GUIRender(RC);

            _sOClist = new SceneObjectContainer[_lanesArray][];
            _sRlist = new SceneRenderer[_lanesArray][];
            _scene = new SceneContainer[_lanesArray][];

            for ( int c1 = 0; c1 < _sOClist.Length; c1++ )
            {
                _sOClist[c1] = new SceneObjectContainer[_arrayLength];
            }
            for (int c2 = 0; c2 < _sOClist.Length; c2++)
            {
                _sRlist[c2] = new SceneRenderer[_arrayLength];
            }
            for (int c3 = 0; c3 < _sOClist.Length; c3++)
            {
                _scene[c3] = new SceneContainer[_arrayLength];
            }

            /*
             _sOClist = new SceneObjectContainer[_lanesArray][_arrayLength];
            _sRlist = new SceneRenderer[_lanesArray][_arrayLength];
            _scene = new SceneContainer[_lanesArray][_arrayLength];
             */

            loadC4D("blume_lila", 0, 3, "blume_lila_container");
            _sOClist[0][3].Transform.Scale = _sOClist[0][3].Transform.Scale / 18;
            _sOClist[0][3].Transform.Translation.x = 25;
            _sOClist[0][3].Transform.Translation.y = 80; //Höhe?
            _sOClist[0][3].Transform.Translation.z = 250; //nach Rechts

            loadC4D("blume_gold", 1, 4, "blume_gold_container");
            _sOClist[1][4].Transform.Scale = _sOClist[1][4].Transform.Scale / 18;
            _sOClist[1][4].Transform.Translation.x = 25;
            _sOClist[1][4].Transform.Translation.y = 60; //Höhe?
            _sOClist[1][4].Transform.Translation.z = 180; //nach Rechts

            RC.ClearColor = new float4(0.1f, 0.1f, 0.5f, 1);
            _yAngle = 0;
            _xPos = 0;
        }
Esempio n. 5
0
        private void TestDeserialize()
        {
            var ser = new Serializer();
            SceneContainer mc2;
            using (var file = File.OpenRead(@"Assets/Test.fus"))
            {
                mc2 = ser.Deserialize(file, null, typeof(SceneContainer)) as SceneContainer;
            }
            /**/
            Diagnostics.Log(mc2.ToString());
        }

        private void TestSerialize()
        {
            /**/
            var aMesh = new MeshContainer
            {
                Vertices = new[]
                {
                    new float3(-1, -1, -1),
                    new float3(-1, -1, 1),
                    new float3(-1, 1, -1),
                    new float3(1, -1, -1),
                    new float3(1, 1, 1),
                    new float3(-1, 1, 1),
                    new float3(1, -1, 1),
                    new float3(1, 1, -1),
                },
                Normals = new[]
                {
                    new float3(-1, -1, -1),
                    new float3(-1, -1, 1),
                    new float3(-1, 1, -1),
                    new float3(1, -1, -1),
                    new float3(1, 1, 1),
                    new float3(-1, 1, 1),
                    new float3(1, -1, 1),
                    new float3(1, 1, -1),
                },
                Triangles = new ushort[]
                {
                    0, 1, 2,
                    0, 2, 3,
                    0, 3, 1,
                    4, 5, 6,
                    4, 6, 7,
                    4, 7, 5,
                }
            };

            var aChild = new SceneObjectContainer()
            {
                Mesh = aMesh,
                Transform = new TransformContainer(){Rotation = new float3(0, 0, 0), Translation = new float3(0.11f, 0.11f, 0), Scale = new float3(1, 1, 1)}
            };

            var parent = new SceneContainer()
            {
                Header = new SceneHeader()
                {
                    Version = 1,
                    Generator = "Fusee.SceneViewer",
                    CreatedBy = "FuseeProjetTeam"
                },
                Children = new List<SceneObjectContainer>(new SceneObjectContainer[]
                {
                    aChild,
                    aChild,
                    new SceneObjectContainer()
                    {
                        Mesh = aMesh,
                        Transform = new TransformContainer(){Rotation = new float3(0, 0, 0), Translation = new float3(0.22f, 0.22f, 0), Scale = new float3(1, 1, 1)}
                    },
                }),
            };
            var ser = new Serializer();
            using (var file = File.Create(@"Assets/Test.fus"))
            {
                ser.Serialize(file, parent);
            }
        }
Esempio n. 6
0
        public override void Init()
        {
            // Initialisierung der Sound-Dateien (.mp3)
            _ton_sammeln = Audio.Instance.LoadFile("Assets/schmotzer1.mp3", true);
            _ton_weg = Audio.Instance.LoadFile("Assets/Klick2.mp3", true);
            _ton_abgeben = Audio.Instance.LoadFile("Assets/slash1.mp3", true);
            _ton_fliegen = Audio.Instance.LoadFile("Assets/biene_LOOP2.mp3", true);
            _ton_hintergrund = Audio.Instance.LoadFile("Assets/backgroundmusic_tech.mp3",true);
            // Initialisierung der Fenstergröße
            _screenWidth = Screen.PrimaryScreen.Bounds.Width;
            _screenWidthAspect = 1;
            _screenHeight = Screen.PrimaryScreen.Bounds.Height;
            _screenHeightAspect = 1;
            SetWindowSize(_screenWidth, _screenHeight / 9 * 2, true, 0, 0);

            var seri = new Serializer();

            #region LevelInit
            using (var fileLevel = File.OpenRead(@"Assets/ground.fus"))
            {
                _levelSC = seri.Deserialize(fileLevel, null, typeof(SceneContainer)) as SceneContainer;
            }
            _levelSR = new SceneRenderer(_levelSC, "Assets");
            _levelSOC = FindByName("landscape_container", _levelSC.Children);
            //_levelSOC.Transform.Scale = _levelSOC.Transform.Scale / 30;

            using (var fileLevel = File.OpenRead(@"Assets/Bienenstock.fus"))
            {
                _stockSC = seri.Deserialize(fileLevel, null, typeof(SceneContainer)) as SceneContainer;
            }
            _stockSR = new SceneRenderer(_stockSC, "Assets");
            _stockSOC = FindByName("bienenstock", _stockSC.Children);
            #endregion

            #region PlayerInit
            using (var filePlayer = File.OpenRead(@"Assets/Biene.fus"))
            {
                _playerSC = seri.Deserialize(filePlayer, null, typeof(SceneContainer)) as SceneContainer;
            }
            _playerSR = new SceneRenderer(_playerSC, "Assets");
            _playerSOC = FindByName("Biene", _playerSC.Children);
            _playerSOC.Transform.Scale = _playerSOC.Transform.Scale / 25;
            _playerSOC.Transform.Rotation.z = _twoPi/2;
            _playerSOC.Transform.Rotation.x = _twoPi/2;

            if (_playerSOC != null)
            {
                _playerSOC.Transform.Translation.z = 200;
                _playerSOC.Transform.Translation.y = 500;
            }
            #endregion

            #region ArrayInit
            _sOClist = new SceneObjectContainer[_lanesArray][];
            _sRlist = new SceneRenderer[_lanesArray][];
            _scene = new SceneContainer[_lanesArray][];

            for (int c1 = 0; c1 < _sOClist.Length; c1++)
            {
                _sOClist[c1] = new SceneObjectContainer[_arrayLength];
            }
            for (int c2 = 0; c2 < _sOClist.Length; c2++)
            {
                _sRlist[c2] = new SceneRenderer[_arrayLength];
            }
            for (int c3 = 0; c3 < _sOClist.Length; c3++)
            {
                _scene[c3] = new SceneContainer[_arrayLength];
            }

            //Enemy
            _enemySOClist = new SceneObjectContainer[_lanesArray][];
            _enemySRlist = new SceneRenderer[_lanesArray][];
            _enemyScene = new SceneContainer[_lanesArray][];

            for (int c1 = 0; c1 < _enemySOClist.Length; c1++)
            {
                _enemySOClist[c1] = new SceneObjectContainer[_arrayLength];
            }
            for (int c2 = 0; c2 < _enemySOClist.Length; c2++)
            {
                _enemySRlist[c2] = new SceneRenderer[_arrayLength];
            }
            for (int c3 = 0; c3 < _enemySOClist.Length; c3++)
            {
                _enemyScene[c3] = new SceneContainer[_arrayLength];
            }

            _objCountOnLane = new int[_lanesArray];
            for (int c4 = 0; c4 < _objCountOnLane.Length; c4++)
            {
                _objCountOnLane[c4] = 0;
            }
            _enemyMove = new bool[_arrayLength];
            for (int c5 = 0; c5 < _enemyMove.Length; c5++)
            {
                _enemyMove[c5] = true;
            }
            #endregion

            // Erzeugung der Blumen auf den Lanes
            for (int aCount = 0; aCount < 15; aCount++)
            {
                SpawnFlower();
            }
            // Erzeugung der Gegner auf den Lanes
            for (int aCount = 0; aCount < _lanesArray + _lanesArray/2; aCount++)
            {
                SpawnEnemy();
            }

            RC.ClearColor = new float4(0.1f, 0.1f, 0.5f, 1);
            _yPos = 100;
            _xPos = 150;
            _gameState = GameState.GameStart; // Spiel auf Startbildschirm setzen

            _guiRender = new GUIRender(RC, this);
            _guiRender.StartMenue(); // Rendern des Startmenüs

            _ton_hintergrund.Play(true); // Abspielen der Hintergrundmusik und Lautstärke setzen
            _ton_fliegen.Volume = 100;
            _ton_fliegen.Play(true); // Abspielen des Flügelschlags und und Lautstärke setzen
            _ton_fliegen.Volume = 0;
        }