public PowerUpGUIItem(Vector2 spritePosition, PowerUpType type) : base(spritePosition, "speedUp") { Type = type; Enabled = false; sprite.SetMultiplyTint(colorDisabled); switch (type) { //mettere costanti nelle classi case PowerUpType.SpeedUp: texture = GfxManager.GetSpritesheet("speedUp").Item1; break; case PowerUpType.SpeedDown: texture = GfxManager.GetSpritesheet("speedDown").Item1; break; case PowerUpType.BombUp: texture = GfxManager.GetSpritesheet("bombUp").Item1; break; case PowerUpType.BombDown: texture = GfxManager.GetSpritesheet("bombDown").Item1; break; case PowerUpType.Invincibility: texture = GfxManager.GetSpritesheet("invincibility").Item1; break; case PowerUpType.ExtraLife: texture = GfxManager.GetSpritesheet("extraLife").Item1; break; } }
public static void Play() { GfxManager.Load(); AudioManager.Load(); Scene playScene = new PlayScene(); Scene gameOverScene = new GameOverScene(); playScene.NextScene = gameOverScene; gameOverScene.PreviousScene = playScene; CurrScene = playScene; CurrScene.Start(); while (Window.IsOpened) { //float fps = 1 / Window.deltaTime; //Console.SetCursorPosition(0, 0); //if (fps < 59) // Console.Write((1 / Window.deltaTime) + " "); if (Window.GetKey(KeyCode.Esc)) break; if (!CurrScene.IsPlaying) { if (SceneToLoad == SceneLoad.Next) { if (CurrScene.NextScene != null) { CurrScene.OnExit(); CurrScene = CurrScene.NextScene; CurrScene.Start(); } else return; } else { if (CurrScene.PreviousScene != null) { CurrScene.OnExit(); CurrScene = CurrScene.PreviousScene; CurrScene.Start(); SceneToLoad = SceneLoad.Next; } else return; } } CurrScene.Input(); CurrScene.Update(); CurrScene.Draw(); Window.Update(); } }
public BombPowerUp(Vector2 spritePosition, BombType bombType) : base(spritePosition, "bombUp") { if (bombType == BombType.Up) { Type = PowerUpType.BombUp; timeToDeactivePowerUp = 16f; } else { texture = GfxManager.GetSpritesheet("bombDown").Item1; Type = PowerUpType.BombDown; timeToDeactivePowerUp = 8f; clipOnPicked = AudioManager.GetAudioClip("powerUp2"); } }
public Circle(Vector2 offset, RigidBody owner, float ray) { relativePosition = offset; RigidBody = owner; Ray = ray; if (Debug) { IsActive = true; circleCollider = new Sprite(ray * 2, ray * 2); texture = GfxManager.GetSpritesheet("circle").Item1; Layer = DrawManager.Layer.Foreground; DrawManager.AddItem(this); UpdateManager.AddItem(this); } }
public SpeedPowerUp(Vector2 spritePosition, SpeedType speedType) : base(spritePosition, "speedUp") { if (speedType == SpeedType.UP) { speedIncrement = 2f; Type = PowerUpType.SpeedUp; timeToDeactivePowerUp = 15f; } else { Type = PowerUpType.SpeedDown; speedIncrement = -2f; texture = GfxManager.GetSpritesheet("speedDown").Item1; timeToDeactivePowerUp = 10f; clipOnPicked = AudioManager.GetAudioClip("powerUp2"); } }
public Rect(Vector2 offset, RigidBody owner, float width, float height) { relativePosition = offset; RigidBody = owner; HalfWidth = width / 2; HalfHeight = height / 2; if (Debug) { IsActive = true; rectCollider = new Sprite(width, height); texture = GfxManager.GetSpritesheet("rectangle").Item1; Layer = DrawManager.Layer.Foreground; DrawManager.AddItem(this); UpdateManager.AddItem(this); } }
public GameObject( Vector2 spritePosition, string spriteSheetName, DrawManager.Layer drawLayer = DrawManager.Layer.Playground) { Tuple <Texture, List <Animation> > ss = GfxManager.GetSpritesheet(spriteSheetName); texture = ss.Item1; animations = ss.Item2; Animation = animations[0]; sprite = new Sprite(Game.PixelsToUnit(Animation.FrameWidth), Game.PixelsToUnit(Animation.FrameHeight)); sprite.position = spritePosition; sprite.pivot = new Vector2(Width / 2, Height / 2); layer = drawLayer; IsActive = true; UpdateManager.AddItem(this); DrawManager.AddItem(this); }