void Start() { int childCount = mapObject.childCount; segments = new Transform[childCount]; extents = new float[childCount]; renderers = new Renderer[childCount]; int i = 0; foreach(Transform child in mapObject) { segments[i] = child; renderers[i] = child.GetComponent<Renderer>(); if (renderers[i] != null) { extents[i] = renderers[i].bounds.extents.x; } else { extents[i] = 2; } i++; } parallax = Camera.main.GetComponent<Parallax>(); foreach (Transform t in segments) { TurnOff(t); } }
/// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IApp page) { var data = default(DataTable); var Current = default(DataRow); var pitems = new IHTMLDiv[0]; Action CurrentChanged = delegate { Console.WriteLine("CurrentChanged"); for (int i = 0; i < data.Rows.Count; i++) { if (data.Rows.AsEnumerable().ElementAt(i) == Current) { pitems[i].style.boxShadow = "blue 0 0 18px inset"; } else { pitems[i].style.boxShadow = "gray 0 0 8px inset"; } } data.Columns.AsEnumerable().WithEach( c => { var selector = "[data-column='" + c.ColumnName + "']"; Console.WriteLine(new { selector }); // stackoverflow.com/questions/10777684/how-to-use-queryselectorall-only-for-elements-that-have-a-specific-attribute-set // http://stackoverflow.com/questions/8694460/queryselectorall-get-all-tags-that-have-an-attribute-set if (Current == null) { page.DesignTimeStyle.StyleSheet.disabled = false; } else { page.DesignTimeStyle.StyleSheet.disabled = true; Native.document.body.querySelectorAll(selector).WithEach( node => { var x = (IHTMLElement)node; var value = Current[c]; x.css.before.style.content = "'" + new { selector, value }.ToString().Replace("'", "\\'") + "'"; } ); } } ); }; Native.window.requestAnimationFrame += async delegate { var scope_data = await this.DoEnterData(); data = scope_data; //Native.document.body.style.position = IStyle.PositionEnum.@fixed; // per browser? var step = 40; page.beancounter.style.height = (data.Rows.Count * step) + "px"; var p = new Parallax(); var pitem = p.item.Orphanize(); pitems = data.Rows.AsEnumerable().Select( x => { var y = new Parallax().item; y.AttachTo(p.Container); y.style.height = (100.0 / data.Rows.Count) + "%"; return y; } ).ToArray(); p.AttachToDocument(); Current = data.Rows.AsEnumerable().FirstOrDefault(); CurrentChanged(); Native.document.title = new { data.Rows.Count }.ToString(); //Native.window.onframe += // delegate // { // p.Container.style.height = // Native.document.body.scrollHeight + "px"; // }; Native.window.onscroll += delegate { var scrollTop = Math.Max( // why the difference? // IE Native.document.documentElement.scrollTop, // chrome Native.document.body.scrollTop ); Native.document.title = new { scrollTop }.ToString(); var offset = (int)Math.Floor((double)scrollTop / step); // script: error JSC1000: No implementation found for this native method, please implement [System.Data.DataRowCollection.get_Item(System.Int32)] Current = data.Rows.AsEnumerable().ElementAt(offset); CurrentChanged(); }; }; }
public void LoadBackground(Sprite image) { m_backgroundPar = GetComponentInChildren<Parallax>(); m_backgroundPar.SetImage(image, m_width, m_height); }
public override void LoadContent() { ContentManager content = ScreenManager.Game.Content; map = content.Load<Map>("map"); MapGeneration.Generate(map); camera = new Camera(ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight, map); //camera.Zoom = 0.5f; text = content.Load<Texture2D>("titles"); hud = new HUD(content.Load<Texture2D>("hud")); waterLevel = ScreenManager.Game.RenderHeight; waterParallax = new Parallax(content.Load<Texture2D>("abovewater-parallax"), 12, 0.5f, waterLevel, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, true); underwaterBGParallax = new Parallax(content.Load<Texture2D>("underwater-bg"), 4, 1f, waterLevel + 20, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), true, false); skyBGParallax = new Parallax(content.Load<Texture2D>("sky-bg"), 72, 1f, 70, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, false); rocksParallax = new Parallax(content.Load<Texture2D>("seabed-rocks"), 16, 0.35f, (map.TileHeight*map.Height) -15, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, false); cloudsParallax = new Parallax(content.Load<Texture2D>("clouds"), 16, 0.35f, 25, (map.TileWidth * map.Width), new Viewport(0, 0, ScreenManager.Game.RenderWidth, ScreenManager.Game.RenderHeight), false, false, true); playerShip = new Ship(content.Load<Texture2D>("playership"), new Rectangle(0,0,10,10), null, Vector2.Zero); playerShip.Position = new Vector2(64, 190); particleController.LoadContent(content); projectileController = new ProjectileController(1000, sheet => new Projectile(sheet, new Rectangle(0, 0, 4, 4), null, new Vector2(0, 0)) , content.Load<Texture2D>("projectiles")); enemyController = new EnemyController(content.Load<Texture2D>("enemies"), content.Load<Texture2D>("boss")); powerupController = new PowerupController(1000,sheet => new Powerup(sheet, new Rectangle(0, 0, 6, 6), null, Vector2.Zero),content.Load<Texture2D>("powerup")); powerupController.BoxCollidesWith.Add(playerShip); projectileController.BoxCollidesWith.Add(playerShip); projectileController.BoxCollidesWith.Add(enemyController); projectileController.BoxCollidesWith.Add(projectileController); enemyController.BoxCollidesWith.Add(playerShip); enemyController.BoxCollidesWith.Add(projectileController); GameController.Reset(); //enemyController.SpawnInitial(GameController.Wave, map); base.LoadContent(); }
private Backdrop ParseBackdrop(BinaryPacker.Element child, BinaryPacker.Element above) { Backdrop backdrop; if (child.Name.Equals("parallax", StringComparison.OrdinalIgnoreCase)) { string id = child.Attr("texture", ""); string str1 = child.Attr("atlas", "game"); //Parallax parallax = new Parallax(!(str1 == "game") || !GFX.Game.Has(id) ? (!(str1 == "gui") || !GFX.Gui.Has(id) ? GFX.Misc[id] : GFX.Gui[id]) : GFX.Game[id]); Parallax parallax = null; if (Gfx.Game.Has(id)) { parallax = new Parallax(Gfx.Game[id]); } else { parallax = new Parallax(Gfx.Misc[id]); } backdrop = (Backdrop)parallax; string str2 = ""; if (child.HasAttr("blendmode")) { str2 = child.Attr("blendmode", "alphablend").ToLower(); } else if (above != null && above.HasAttr("blendmode")) { str2 = above.Attr("blendmode", "alphablend").ToLower(); } if (str2.Equals("additive")) { parallax.BlendState = BlendState.defaultValue; } parallax.DoFadeIn = bool.Parse(child.Attr("fadeIn", "false")); } else if (child.Name.Equals("snowfg", StringComparison.OrdinalIgnoreCase)) { backdrop = (Backdrop) new Snow(true); } else if (child.Name.Equals("snowbg", StringComparison.OrdinalIgnoreCase)) { backdrop = (Backdrop) new Snow(false); } //else if (child.Name.Equals("windsnow", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new WindSnowFG(); //else if (child.Name.Equals("dreamstars", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new DreamStars(); //else if (child.Name.Equals("stars", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new StarsBG(); //else if (child.Name.Equals("mirrorfg", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new MirrorFG(); //else if (child.Name.Equals("reflectionfg", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new ReflectionFG(); //else if (child.Name.Equals("godrays", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new Godrays(); //else if (child.Name.Equals("tentacles", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new Tentacles((Tentacles.Side)Enum.Parse(typeof(Tentacles.Side), child.Attr("side", "Right")), Calc.HexToColor(child.Attr("color", "")), child.AttrFloat("offset", 0.0f)); //else if (child.Name.Equals("northernlights", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new NorthernLights(); //else if (child.Name.Equals("bossStarField", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new FinalBossStarfield(); //else if (child.Name.Equals("petals", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new Petals(); //else if (child.Name.Equals("heatwave", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new HeatWave(); //else if (child.Name.Equals("corestarsfg", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new CoreStarsFG(); //else if (child.Name.Equals("starfield", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new Starfield(Calc.HexToColor(child.Attr("color", "")), child.AttrFloat("speed", 1f)); //else if (child.Name.Equals("planets", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new Planets((int)child.AttrFloat("count", 32f), child.Attr("size", "small")); //else if (child.Name.Equals("rain", StringComparison.OrdinalIgnoreCase)) // backdrop = (Backdrop)new RainFG(); //else if (child.Name.Equals("stardust", StringComparison.OrdinalIgnoreCase)) //{ // backdrop = (Backdrop)new StardustFG(); //} else { if (!child.Name.Equals("blackhole", StringComparison.OrdinalIgnoreCase)) { throw new Exception("Background type " + child.Name + " does not exist"); } backdrop = (Backdrop) new BlackholeBG(); } if (child.HasAttr("tag")) { backdrop.Tags.Add(child.Attr("tag", "")); } if (above != null && above.HasAttr("tag")) { backdrop.Tags.Add(above.Attr("tag", "")); } if (child.HasAttr("x")) { backdrop.Position.x = child.AttrFloat("x", 0.0f); } else if (above != null && above.HasAttr("x")) { backdrop.Position.x = above.AttrFloat("x", 0.0f); } if (child.HasAttr("y")) { backdrop.Position.y = child.AttrFloat("y", 0.0f); } else if (above != null && above.HasAttr("y")) { backdrop.Position.y = above.AttrFloat("y", 0.0f); } if (child.HasAttr("scrollx")) { backdrop.Scroll.x = child.AttrFloat("scrollx", 0.0f); } else if (above != null && above.HasAttr("scrollx")) { backdrop.Scroll.x = above.AttrFloat("scrollx", 0.0f); } if (child.HasAttr("scrolly")) { backdrop.Scroll.y = child.AttrFloat("scrolly", 0.0f); } else if (above != null && above.HasAttr("scrolly")) { backdrop.Scroll.y = above.AttrFloat("scrolly", 0.0f); } if (child.HasAttr("speedx")) { backdrop.Speed.x = child.AttrFloat("speedx", 0.0f); } else if (above != null && above.HasAttr("speedx")) { backdrop.Speed.x = above.AttrFloat("speedx", 0.0f); } if (child.HasAttr("speedy")) { backdrop.Speed.y = child.AttrFloat("speedy", 0.0f); } else if (above != null && above.HasAttr("speedy")) { backdrop.Speed.y = above.AttrFloat("speedy", 0.0f); } backdrop.Color = Color.white; if (child.HasAttr("color")) { backdrop.Color = Util.HexToColor(child.Attr("color", "")); } else if (above != null && above.HasAttr("color")) { backdrop.Color = Util.HexToColor(above.Attr("color", "")); } if (child.HasAttr("alpha")) { backdrop.Color *= child.AttrFloat("alpha", 0.0f); } else if (above != null && above.HasAttr("alpha")) { backdrop.Color *= above.AttrFloat("alpha", 0.0f); } if (child.HasAttr("flipx")) { backdrop.FlipX = child.AttrBool("flipx", false); } else if (above != null && above.HasAttr("flipx")) { backdrop.FlipX = above.AttrBool("flipx", false); } if (child.HasAttr("flipy")) { backdrop.FlipY = child.AttrBool("flipy", false); } else if (above != null && above.HasAttr("flipy")) { backdrop.FlipY = above.AttrBool("flipy", false); } if (child.HasAttr("loopx")) { backdrop.LoopX = child.AttrBool("loopx", false); } else if (above != null && above.HasAttr("loopx")) { backdrop.LoopX = above.AttrBool("loopx", false); } if (child.HasAttr("loopy")) { backdrop.LoopY = child.AttrBool("loopy", false); } else if (above != null && above.HasAttr("loopy")) { backdrop.LoopY = above.AttrBool("loopy", false); } if (child.HasAttr("wind")) { backdrop.WindMultiplier = child.AttrFloat("wind", 0.0f); } else if (above != null && above.HasAttr("wind")) { backdrop.WindMultiplier = above.AttrFloat("wind", 0.0f); } string list1 = (string)null; if (child.HasAttr("exclude")) { list1 = child.Attr("exclude", ""); } else if (above != null && above.HasAttr("exclude")) { list1 = above.Attr("exclude", ""); } if (list1 != null) { backdrop.ExcludeFrom = this.ParseLevelsList(list1); } string list2 = (string)null; if (child.HasAttr("only")) { list2 = child.Attr("only", ""); } else if (above != null && above.HasAttr("only")) { list2 = above.Attr("only", ""); } if (list2 != null) { backdrop.OnlyIn = this.ParseLevelsList(list2); } string str3 = (string)null; if (child.HasAttr("flag")) { str3 = child.Attr("flag", ""); } else if (above != null && above.HasAttr("flag")) { str3 = above.Attr("flag", ""); } if (str3 != null) { backdrop.OnlyIfFlag = str3; } string str4 = (string)null; if (child.HasAttr("notflag")) { str4 = child.Attr("notflag", ""); } else if (above != null && above.HasAttr("notflag")) { str4 = above.Attr("notflag", ""); } if (str4 != null) { backdrop.OnlyIfNotFlag = str4; } string str5 = (string)null; if (child.HasAttr("always")) { str5 = child.Attr("always", ""); } else if (above != null && above.HasAttr("always")) { str5 = above.Attr("always", ""); } if (str5 != null) { backdrop.AlsoIfFlag = str5; } bool?nullable = new bool?(); if (child.HasAttr("dreaming")) { nullable = new bool?(child.AttrBool("dreaming", false)); } else if (above != null && above.HasAttr("dreaming")) { nullable = new bool?(above.AttrBool("dreaming", false)); } if (nullable.HasValue) { backdrop.Dreaming = nullable; } if (child.HasAttr("instantIn")) { backdrop.InstantIn = child.AttrBool("instantIn", false); } else if (above != null && above.HasAttr("instantIn")) { backdrop.InstantIn = above.AttrBool("instantIn", false); } if (child.HasAttr("instantOut")) { backdrop.InstantOut = child.AttrBool("instantOut", false); } else if (above != null && above.HasAttr("instantOut")) { backdrop.InstantOut = above.AttrBool("instantOut", false); } string str6 = (string)null; if (child.HasAttr("fadex")) { str6 = child.Attr("fadex", ""); } else if (above != null && above.HasAttr("fadex")) { str6 = above.Attr("fadex", ""); } if (str6 != null) { backdrop.FadeX = new Backdrop.Fader(); string str1 = str6; char[] chArray1 = new char[1] { ':' }; foreach (string str2 in str1.Split(chArray1)) { char[] chArray2 = new char[1] { ',' }; string[] strArray1 = str2.Split(chArray2); if (strArray1.Length == 2) { string[] strArray2 = strArray1[0].Split('-'); string[] strArray3 = strArray1[1].Split('-'); float fadeFrom = float.Parse(strArray3[0], (IFormatProvider)CultureInfo.InvariantCulture); float fadeTo = float.Parse(strArray3[1], (IFormatProvider)CultureInfo.InvariantCulture); int num1 = 1; int num2 = 1; if (strArray2[0][0] == 'n') { num1 = -1; strArray2[0] = strArray2[0].Substring(1); } if (strArray2[1][0] == 'n') { num2 = -1; strArray2[1] = strArray2[1].Substring(1); } backdrop.FadeX.Add((float)(num1 * int.Parse(strArray2[0])), (float)(num2 * int.Parse(strArray2[1])), fadeFrom, fadeTo); } } } string str7 = (string)null; if (child.HasAttr("fadey")) { str7 = child.Attr("fadey", ""); } else if (above != null && above.HasAttr("fadey")) { str7 = above.Attr("fadey", ""); } if (str7 != null) { backdrop.FadeY = new Backdrop.Fader(); string str1 = str7; char[] chArray1 = new char[1] { ':' }; foreach (string str2 in str1.Split(chArray1)) { char[] chArray2 = new char[1] { ',' }; string[] strArray1 = str2.Split(chArray2); if (strArray1.Length == 2) { string[] strArray2 = strArray1[0].Split('-'); string[] strArray3 = strArray1[1].Split('-'); float fadeFrom = float.Parse(strArray3[0], (IFormatProvider)CultureInfo.InvariantCulture); float fadeTo = float.Parse(strArray3[1], (IFormatProvider)CultureInfo.InvariantCulture); int num1 = 1; int num2 = 1; if (strArray2[0][0] == 'n') { num1 = -1; strArray2[0] = strArray2[0].Substring(1); } if (strArray2[1][0] == 'n') { num2 = -1; strArray2[1] = strArray2[1].Substring(1); } backdrop.FadeY.Add((float)(num1 * int.Parse(strArray2[0])), (float)(num2 * int.Parse(strArray2[1])), fadeFrom, fadeTo); } } } backdrop.OnRefresh(); return(backdrop); }
public float maxSpeed; //Move speed of last image //Get static reference void Awake() { i = this; }
public override void OnInspectorGUI() { CheckUndo(); // Camera manager.SetParallaxCamera((Camera)EditorGUILayout.ObjectField("Camera", manager.GetParallaxCamera(), typeof(Camera) #if !UNITY_3_3 , true #endif )); // Scroll Axes manager.SetScrollConstraints((ScrollConstraints)EditorGUILayout.EnumPopup("Scroll Axes", manager.GetScrollConstraints())); // Base Speed manager.SetBaseSpeed(EditorGUILayout.FloatField("Base Speed", manager.GetBaseSpeed())); // Automatic bool auto = EditorGUILayout.Toggle("Automatic", manager.automatic); if (auto != manager.automatic) { manager.automatic = auto; Parallax.RefreshAllBillboards(); } if (!manager.automatic) { manager.minSize = EditorGUILayout.Vector2Field("Min Size", manager.minSize); manager.maxSize = EditorGUILayout.Vector2Field("Max Size", manager.maxSize); } // Pixel size manager.pixelDensity = EditorGUILayout.FloatField("Pixel Density", manager.pixelDensity); // Autorefresh bool autoRefresh = EditorGUILayout.Toggle("Auto-Refresh Meshes", manager.autoRefreshBillboards); if (autoRefresh != manager.autoRefreshBillboards) { manager.autoRefreshBillboards = autoRefresh; Parallax.RefreshAllBillboards(); } // Reset All Layers GUI.color = Color.red; if (GUILayout.Button("Set All Layers to Auto")) { for (int s = 0; s < manager.Length; s++) { manager[s].isAutoConfigured = true; } } GUI.color = Color.white; if (GUI.changed) { EditorPrefs.SetBool("Thinkscroller.AboutFoldout", aboutFoldout); EditorUtility.SetDirty(target); Repaint(); guiChanged = true; } if (Event.current.type == EventType.ExecuteCommand) { Undo.CreateSnapshot(); Undo.RegisterSnapshot(); } aboutFoldout = EditorGUILayout.Foldout(aboutFoldout, " About Thinkscroller"); if (aboutFoldout) { GUILayout.Label(version); GUILayout.Label( "(c) 2011-2012 Thinksquirrel Software, LLC.\n" + "All rights reserved."); GUILayout.Label("Designed by Josh Montoute"); if (GUILayout.Button("Rate this package! (Unity Asset Store)")) { Application.OpenURL("com.unity3d.kharma:content/2024"); } } EditorGUILayout.Separator(); }
private void OnEnable() { manager = target as Parallax; }
/// <summary> /// This is to load the Game Manager's sprites and classes. /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(Game.GraphicsDevice); playerTexture = Game.Content.Load <Texture2D>(@"images\players\mage"); debugDotTexture = Game.Content.Load <Texture2D>(@"images\other\line"); ProjectileTexture = Game.Content.Load <Texture2D>(@"images\projectiles\beam"); plainsParallax1 = Game.Content.Load <Texture2D>(@"images\parallax\plainsbackground1"); plainsParallax2 = Game.Content.Load <Texture2D>(@"images\parallax\plainsbackground2"); plainsParallax3 = Game.Content.Load <Texture2D>(@"images\parallax\plainsbackground3"); forestParallax1 = Game.Content.Load <Texture2D>(@"images\parallax\forestbackground1"); forestParallax2 = Game.Content.Load <Texture2D>(@"images\parallax\forestbackground2"); forestParallax3 = Game.Content.Load <Texture2D>(@"images\parallax\forestbackground3"); caveParallax1 = Game.Content.Load <Texture2D>(@"images\parallax\cavebackground1"); caveParallax2 = Game.Content.Load <Texture2D>(@"images\parallax\cavebackground2"); caveParallax3 = Game.Content.Load <Texture2D>(@"images\parallax\cavebackground3"); villageParallax1 = Game.Content.Load <Texture2D>(@"images\parallax\village"); cEnemyTexture = Game.Content.Load <Texture2D>(@"images\enemies\CircleEnemy"); sEnemyTexture = Game.Content.Load <Texture2D>(@"images\enemies\SquareEnemy"); tEnemyTexture = Game.Content.Load <Texture2D>(@"images\enemies\TriangleEnemy"); bflEnemyTexture = Game.Content.Load <Texture2D>(@"images\boss\bossfistleft"); bfrEnemyTexture = Game.Content.Load <Texture2D>(@"images\boss\bossfistright"); bhEnemyTexture = Game.Content.Load <Texture2D>(@"images\boss\bosshead"); plainsPlatformTexture = Game.Content.Load <Texture2D>(@"images\tiles\plainsTiles"); forestPlatformTexture = Game.Content.Load <Texture2D>(@"images\tiles\forestTiles"); cavePlatformTexture = Game.Content.Load <Texture2D>(@"images\tiles\caveTiles"); villagePlatformTexture = Game.Content.Load <Texture2D>(@"images\tiles\villageTiles"); forestSong = Game.Content.Load <Song>(@"sounds\music\forest"); finalBossSong = Game.Content.Load <Song>(@"sounds\music\finalboss"); caveSong = Game.Content.Load <Song>(@"sounds\music\cave"); plainsvillagesSong = Game.Content.Load <Song>(@"sounds\music\plains-villages"); shootSFX = Game.Content.Load <SoundEffect>(@"sounds\sfx\projectiles"); bosshitSFX = Game.Content.Load <SoundEffect>(@"sounds\sfx\bosshit"); enemyhitSFX = Game.Content.Load <SoundEffect>(@"sounds\sfx\enemyhit"); wintext = Game.Content.Load <SpriteFont>(@"fonts\segoeuiregularlarge"); camera = new Camera(GraphicsDevice.Viewport, new Point(6400, 450), 1f); camera.Position = new Vector2(0, 0); mapSegments.Add(new Rectangle(-5, 0, 5, (int)camera.Size.Y)); mapSegments.Add(new Rectangle((int)camera.Size.X, 0, 5, (int)camera.Size.Y)); plainsParallax1Background = new Parallax(plainsParallax1, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(1.000f, 0.0f), camera); plainsParallax2Background = new Parallax(plainsParallax2, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(1.125f, 0.0f), camera); plainsParallax3Background = new Parallax(plainsParallax3, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(1.250f, 0.0f), camera); villageParallax1Background = new Parallax(villageParallax1, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(0.750f, 0.0f), camera); forestParallax1Background = new Parallax(forestParallax1, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(1.000f, 0.0f), camera); forestParallax2Background = new Parallax(forestParallax2, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(1.125f, 0.0f), camera); forestParallax3Background = new Parallax(forestParallax3, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(1.250f, 0.0f), camera); caveParallax1Background = new Parallax(caveParallax1, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(1.000f, 0.0f), camera); caveParallax2Background = new Parallax(caveParallax2, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(1.125f, 0.0f), camera); caveParallax3Background = new Parallax(caveParallax3, new Vector2(camera.Position.X - (myGame.WindowSize.X / 2), 0), Color.White, new Vector2(1.250f, 0.0f), camera); playerAnimationSetList.Add(new Sprite.AnimationSet("IDLE", playerTexture, new Point(124, 148), new Point(4, 1), new Point(0, 2), 1600, true)); playerAnimationSetList.Add(new Sprite.AnimationSet("WALK", playerTexture, new Point(100, 140), new Point(8, 1), new Point(0, 476), 100, true)); playerAnimationSetList.Add(new Sprite.AnimationSet("JUMP", playerTexture, new Point(187, 174), new Point(4, 1), new Point(0, 302), 1600, true)); playerAnimationSetList.Add(new Sprite.AnimationSet("SHOOT", playerTexture, new Point(124, 148), new Point(5, 1), new Point(0, 154), 1600, true)); cEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", cEnemyTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 1600, true)); cEnemyAnimationSetList.Add(new Sprite.AnimationSet("CHASE", cEnemyTexture, new Point(25, 25), new Point(9, 1), new Point(25, 0), 100, true)); //Needs rest of animations ^ sEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", sEnemyTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 1600, true)); sEnemyAnimationSetList.Add(new Sprite.AnimationSet("CHASE", sEnemyTexture, new Point(25, 25), new Point(5, 1), new Point(0, 0), 100, true)); sEnemyAnimationSetList.Add(new Sprite.AnimationSet("FALLING", sEnemyTexture, new Point(25, 25), new Point(4, 1), new Point(150, 0), 100, true)); //Needs edit ^ tEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", tEnemyTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 1000, true)); //Needs edit ^ bflEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", bflEnemyTexture, new Point(88, 100), new Point(1, 1), new Point(0, 0), 1600, true)); bfrEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE", bfrEnemyTexture, new Point(88, 100), new Point(1, 1), new Point(0, 0), 1600, true)); bflEnemyAnimationSetList.Add(new Sprite.AnimationSet("CHASE", bflEnemyTexture, new Point(88, 100), new Point(1, 1), new Point(0, 0), 100, true)); bfrEnemyAnimationSetList.Add(new Sprite.AnimationSet("CHASE", bfrEnemyTexture, new Point(88, 100), new Point(1, 1), new Point(0, 0), 100, true)); bflEnemyAnimationSetList.Add(new Sprite.AnimationSet("FALLING", bflEnemyTexture, new Point(88, 100), new Point(1, 1), new Point(0, 0), 100, true)); bfrEnemyAnimationSetList.Add(new Sprite.AnimationSet("FALLING", bfrEnemyTexture, new Point(88, 100), new Point(1, 1), new Point(0, 0), 100, true)); bhEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE1", bhEnemyTexture, new Point(180, 242), new Point(1, 1), new Point(0, 0), 1600, true)); bhEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE2", bhEnemyTexture, new Point(180, 242), new Point(1, 1), new Point(360, 0), 1600, true)); bhEnemyAnimationSetList.Add(new Sprite.AnimationSet("IDLE3", bhEnemyTexture, new Point(180, 242), new Point(1, 1), new Point(720, 0), 1600, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("1", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("2", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 0), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("3", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 0), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("4", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 0), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("5", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 25), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("6", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 25), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("7", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 25), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("8", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 25), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("9", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 50), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("10", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 50), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("11", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 50), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("12", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 50), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("13", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 75), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("14", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 75), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("15", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 75), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("16", plainsPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 75), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("17", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("18", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 0), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("19", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 0), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("20", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 0), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("21", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 25), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("22", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 25), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("23", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 25), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("24", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 25), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("25", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 50), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("26", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 50), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("27", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 50), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("28", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 50), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("29", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 75), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("30", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(25, 75), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("31", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(50, 75), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("32", forestPlatformTexture, new Point(25, 25), new Point(1, 1), new Point(75, 75), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("33", cavePlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 0, true)); platformAnimationSetList.Add(new Sprite.AnimationSet("34", villagePlatformTexture, new Point(25, 25), new Point(1, 1), new Point(0, 0), 0, true)); MovementKeys.Add(Keys.A); MovementKeys.Add(Keys.W); MovementKeys.Add(Keys.D); MovementKeys.Add(Keys.S); MovementKeys.Add(Keys.Space); MovementKeys.Add(Keys.E); MovementKeys.Add(Keys.Q); _Mana = new Player.Mana(100, 5000, 100); player = new Player(new Vector2(25, (myGame.WindowSize.Y - playerAnimationSetList[0].frameSize.Y) - 75), MovementKeys, 2f, _Mana, Color.White, playerAnimationSetList, myGame); bhEnemy = new Enemy(new Vector2(0, 0), 0, Enemy.MovementType.BOSSHEAD, Color.White, bhEnemyAnimationSetList, player, platformRectangles, mapSegments); bflEnemy = new Enemy(new Vector2(0, 0), 2.75f, Enemy.MovementType.BOSSBOUNCE, Color.White, bflEnemyAnimationSetList, player, platformRectangles, mapSegments); bfrEnemy = new Enemy(new Vector2(0, 0), 2.75f, Enemy.MovementType.BOSSBOUNCE, Color.White, bfrEnemyAnimationSetList, player, platformRectangles, mapSegments); debugLabel = new Label(new Vector2(0, 0), myGame.segoeUIMonoDebug, 1f, new Color(150, 150, 150), ""); base.LoadContent(); }
private void Awake() { barraDeVida_ref = GameObject.Find("Game").GetComponent <BarraDeVida>(); parallax_ref = GameObject.Find("1Layer1").GetComponent <Parallax>(); }
// Use this for initialization void Start() { backgroundGenerationDifference = backgroundGenerationPoint.transform.position.x - transform.position.x; theParallaxController = FindObjectOfType <Parallax> (); }
public cTransition1(IServiceProvider serviceProvider, GraphicsDeviceManager graphics, int NumPerso) : base(serviceProvider, graphics) { Parallax = new Parallax(RessourceSonic3.BackAct2Front, RessourceSonic3.BackAct2, new Vector2(400, 250)); this.NumPerso = NumPerso; }
public void Page_Unloaded(object sender, EventArgs e) { P = null; }
void UpdateParallax() { Parallax.SetCurrentRatio(Camera.WorldPosition.X / (Match.World.Map.GetWidthTiles() * Tile.WIDTH) * 80, Camera.WorldPosition.Y / (Match.World.Map.GetHeightTiles() * Tile.HEIGHT) * 100); }