public Sheep(RenderContext rc, float3 position, float3 rotation, float3 scaleFactor, SceneRenderer sc, Game game) : base(rc, position, rotation, scaleFactor, sc) { _distance = position.Length; if (_distance > 60) { _score = 120; } if (_distance > 40) { _score = 80; } else { _score = 50; } Speed = (5 / _distance) * game.Level; Radius = 4f; _game = game; Pos = position; _alpha = (float)Math.Tan(Pos.z/Pos.x); Tag = "Sheep"; _level = 1; //zufällige Wellenbewegung if (position.x % 2 == 0) { TheWave = SinWave; } else { TheWave = CosWave; } }
public Tomato(RenderContext rc, float3 position, float3 rotation, float3 scaleFactor,SceneRenderer sc, RigidBody tomatoRigidBody, Game game, DynamicWorld world) : base(rc, position, rotation, scaleFactor, sc) { TomatoRb = tomatoRigidBody; Radius = 2f; Tag = "Tomato"; timer = 2.0f; _game = game; _world = world; }
public Weapon(DynamicWorld world, Game game) { _click = true; _world = world; _sphereCollider = _world.AddSphereShape(1); _game = game; _srTomato = _game.SceneLoader.LoadTomato(); Magazin = 10; imgData = game.RC.LoadImage("Assets/TomateOberflächenfarbe.jpg"); RC = game.RC; }
private SceneRenderer Loader(string name) { // Scene loading SceneContainer scene; var ser = new Serializer(); string filename = "Assets/" + name + ".fus"; using (var file = File.OpenRead(@filename)) { scene = ser.Deserialize(file, null, typeof(SceneContainer)) as SceneContainer; } _sr = new SceneRenderer(scene, "Assets"); return _sr; }
public GameObject(RenderContext rc, float3 position, float3 rotation, float3 scaleFactor, SceneRenderer sc) { SceneRenderer = sc; _rc = rc; _scale = scaleFactor; ObjectMtx = float4x4.CreateRotationX(rotation.x) *float4x4.CreateRotationY(rotation.y) *float4x4.CreateRotationZ(rotation.z) *float4x4.CreateTranslation(position); Rotation = rotation; Tag = "GameObject"; }
// is called on startup public override void Init() { // _myMesh = new Cube(); SceneContainer scene; var ser = new Serializer(); using (var file = File.OpenRead(@"Assets/RGB.fus")) { scene = ser.Deserialize(file, null, typeof(SceneContainer)) as SceneContainer; } _sceneRenderer = new SceneRenderer(scene, "Assets"); // Nach HierWasAendern suchen _sceneObject = FindByName("HierWasAendern", scene.Children); RC.ClearColor = new float4(0.1f, 0.1f, 0.5f, 1); _yAngle = 0; }
public Game(GameHandler gh,RenderContext rc) { _gameHandler = gh; RC = rc; //alle 3D Assets laden SceneLoader = new SceneLoader(); srTomato = SceneLoader.LoadTomato(); srSheep = SceneLoader.LoadSheep(); srTrees = SceneLoader.LoadTrees(); srCows = SceneLoader.LoadCows(); srLandschaft = SceneLoader.LoadEnvironment(); srBuildings = SceneLoader.LoadBuildings(); CreateEnvironment(); //Hürde die zum Austieg zum nächsten level erreicht werden muss _nextLevel = 500; Points = 0; LoadLevel(); _skybox = new Skybox(RC); }
// is called on startup public override void Init() { RC.ClearColor = new float4(1, 1, 1, 1); skypox = LoadSkybox(); var img = RC.LoadImage("Assets/skyboxOberflächenfarbe.jpg"); _iTex = RC.CreateTexture(img); // initialize the variables _meshTea = MeshReader.LoadMesh(@"Assets/Teapot.obj.model"); // _meshFace = MeshReader.LoadMesh(@"Assets/coords.obj.model"); ; _meshFace = new Cube(); _spColor = MoreShaders.GetDiffuseColorShader(RC); _spTexture = MoreShaders.GetTextureShader(RC); _colorParam = _spColor.GetShaderParam("color"); _textureParam = _spTexture.GetShaderParam("texture1"); // load texture //var imgData = RC.LoadImage("Assets/coords.jpg"); //_iTex = RC.CreateTexture(imgData); _zz = 0.0f; }
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; }
private void loadC4D( string name, int lane, int place, string childName) { var ser = new Serializer(); using (var file = File.OpenRead(@"Assets/"+name+".fus")) { _scene[lane][place] = ser.Deserialize(file, null, typeof(SceneContainer)) as SceneContainer; } _sRlist[lane][place] = new SceneRenderer(_scene[lane][place], "Assets"); _sOClist[lane][place] = FindByName(childName, _scene[lane][place].Children); }
// is called on startup public override void Init() { //TestSerialize(); //TestDeserialize(); // GUI initialization _zVal = 500; _guiHandler = new GUIHandler(); _guiHandler.AttachToContext(RC); _guiFuseeLink = new GUIButton(6, 6, 157, 87); _guiFuseeLink.ButtonColor = new float4(0, 0, 0, 0); _guiFuseeLink.BorderColor = new float4(0, 0.6f, 0.2f, 1); _guiFuseeLink.BorderWidth = 0; _guiFuseeLink.OnGUIButtonDown += _guiFuseeLink_OnGUIButtonDown; _guiFuseeLink.OnGUIButtonEnter += _guiFuseeLink_OnGUIButtonEnter; _guiFuseeLink.OnGUIButtonLeave += _guiFuseeLink_OnGUIButtonLeave; _guiHandler.Add(_guiFuseeLink); _guiFuseeLogo = new GUIImage("Assets/FuseeLogo150.png", 10, 10, -5, 150, 80); _guiHandler.Add(_guiFuseeLogo); _guiLatoBlack = RC.LoadFont("Assets/Lato-Black.ttf", 14); _guiSubText = new GUIText("FUSEE 3D Scene Viewer", _guiLatoBlack, 100, 100); _guiSubText.TextColor = new float4(0.05f, 0.25f, 0.15f, 0.8f); _guiHandler.Add(_guiSubText); // Scene loading SceneContainer scene; var ser = new Serializer(); using (var file = File.OpenRead(@"Assets/Model.fus")) { scene = ser.Deserialize(file, null, typeof(SceneContainer)) as SceneContainer; } _sr = new SceneRenderer(scene, "Assets"); AdjustModelScaleOffset(); _guiSubText.Text = "FUSEE 3D Scene"; if (scene.Header.CreatedBy != null || scene.Header.CreationDate != null) { _guiSubText.Text += " created"; if (scene.Header.CreatedBy != null) { _guiSubText.Text += " by " + scene.Header.CreatedBy; } if (scene.Header.CreationDate != null) { _guiSubText.Text += " on " + scene.Header.CreationDate; } } _subtextWidth = GUIText.GetTextWidth(_guiSubText.Text, _guiLatoBlack); _subtextHeight = GUIText.GetTextHeight(_guiSubText.Text, _guiLatoBlack); _sColor = MoreShaders.GetDiffuseColorShader(RC); RC.SetShader(_sColor); _colorParam = _sColor.GetShaderParam("color"); RC.SetShaderParam(_colorParam, new float4(1, 1, 1, 1)); RC.ClearColor = new float4(1, 1, 1, 1); }
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; }