public void InitializeTeleport(Transporter porter, bool _blueBotPorting, Vector2i target) { teleporterWaypoints = new List <Vector2>(); teleporting = true; blueBotPorting = _blueBotPorting; Vector2i startPos = (blueBotPorting) ? botList.Find(b => b.id == 2).mapPosition : mapPosition; teleSpritePos = new Vector2(startPos.X * sizePerCell + 0.5f * sizePerCell, startPos.Y * sizePerCell + sizePerCell * 0.5f); if (blueBotPorting) { GraphicHelper.SetAlpha(0, botList.Find(b => b.id == 2).sprite); } else { GraphicHelper.SetAlpha(0, sprite); } if (Math.Abs(target.X - startPos.X) > Math.Abs(target.Y - startPos.Y)) { teleporterWaypoints.Add(new Vector2(target.X * sizePerCell + sizePerCell * 0.5f, startPos.Y * sizePerCell + sizePerCell * 0.5f)); } else { teleporterWaypoints.Add(new Vector2(startPos.X * sizePerCell + sizePerCell * 0.5f, target.Y * sizePerCell + sizePerCell * 0.5f)); } teleporterWaypoints.Add(new Vector2(target.X * sizePerCell + sizePerCell * 0.5f, target.Y * sizePerCell + sizePerCell * 0.5f)); MusicManager.PlaySound(AssetManager.SoundName.Teleport); }
public bool Teleporting(float deltaTime) { if (teleporterWaypoints.Count > 0) { Vector2 moveVec = teleporterWaypoints[0] - teleSpritePos; if (moveVec.length != 0) { moveVec = moveVec.normalize() * teleSpriteSpeed * deltaTime; } if (moveVec.length < (teleporterWaypoints[0] - teleSpritePos).length) { teleSpritePos += moveVec; } else { teleSpritePos = teleporterWaypoints[0]; teleporterWaypoints.RemoveAt(0); } return(true); } else { if (blueBotPorting) { GraphicHelper.SetAlpha(255, botList.Find(b => b.id == 2).sprite); } else { GraphicHelper.SetAlpha(255, sprite); } teleporting = false; return(false); } }
private void SetAllAphas(float percentage) { foreach (RectangleShape rec in lines) { GraphicHelper.SetAlpha((byte)(175 * percentage / 100), rec); } GraphicHelper.SetAlpha((byte)(255 * percentage / 100), background); GraphicHelper.SetAlpha((byte)(255 * percentage / 100), screenShot); GraphicHelper.SetAlpha((byte)(255 * percentage / 100), levelName); }
private void SetNewTexture() { if (highlighted) { sprite.Texture = glowTexture; sprite.Origin = new Vector2f(sprite.Texture.Size.X * 0.5f, sprite.Texture.Size.Y * 0.5f); } else { sprite.Texture = defaultTexture; sprite.Origin = new Vector2f(sprite.Texture.Size.X * 0.5f, sprite.Texture.Size.Y * 0.5f); } GraphicHelper.SetAlpha(currentAlpha, sprite); if (isIconButton) { GraphicHelper.SetAlpha(currentAlpha, iconSprite); } sprite.TextureRect = new IntRect(0, 0, (int)sprite.Texture.Size.X, (int)sprite.Texture.Size.Y); }
public void Update(float deltaTime) { if (currentTime >= 0) { if (currentTime > (duration * 0.9F)) { GraphicHelper.SetAlpha((byte)(maxOpacity * (1F - (currentTime / duration)) / 0.1F), animSprite); GraphicHelper.SetAlpha((byte)((maxOpacity + 20) * (1F - (currentTime / duration)) / 0.1F), superText); } animSprite.UpdateFrame(deltaTime); superText.Update(deltaTime); currentTime -= deltaTime; if (currentTime < (duration / 2)) { GraphicHelper.SetAlpha((byte)(maxOpacity * currentTime / (duration * 0.5f)), animSprite); GraphicHelper.SetAlpha((byte)((maxOpacity + 20) * currentTime / (duration * 0.5f)), superText); } } else { iShouldKillMyself = true; } }
public int Update(float deltaTime, ManageStars.Rating rating, int curIndex, List <Tutorial> tutorials) { if (finished) { endAnimation.UpdateFrame(deltaTime); endText.Update(deltaTime); if (KeyboardInputManager.Downward(Keyboard.Key.Space)) { mapStatus = 1; } } else { background = new Sprite(AssetManager.backgroundTextures[0]); background.Position = new Vector2f(0, 0); getBackground(curIndex); mapStatus = 0; playerScore = player.scoreCounter; map.Update(deltaTime, player.keyCounter); player.Update(deltaTime, map); itemList.Update(map, player, deltaTime); trapHandler.Update(map, player, deltaTime); levelution.Update(player, map, deltaTime); transporterHandler.Update(player, deltaTime); checkTutorialNeed(rating, curIndex, tutorials); if (currentTutorial != null) { currentTutorial.Update(deltaTime); } if (KeyboardInputManager.Upward(Keyboard.Key.T)) { return(3); } if (KeyboardInputManager.IsPressed(Keyboard.Key.LShift) && KeyboardInputManager.IsPressed(Keyboard.Key.LControl) && KeyboardInputManager.Upward(Keyboard.Key.Y)) { mapStatus = 1; } if (map.CellIsGoal(player.mapPosition) && player.keyCounter >= keysToUnlock) { endSprite = new Sprite(AssetManager.GetTexture(AssetManager.TextureName.LevelInfo)); endSprite.Position = new Vector2f(450, 220); GraphicHelper.SetAlpha(200, endSprite); SetEndMedal(); endMedal.Position = endSprite.Position + new Vector2f(150, 100); endAnimation = new AnimatedSprite(AssetManager.GetTexture(AssetManager.TextureName.SpaceBar), 0.2f, 3); endAnimation.Position = (Vector2)endSprite.Position + new Vector2(125, 200); endText = new SuperText("Congratulations", FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf"), 0.1f); MusicManager.PlaySound(AssetManager.SoundName.Winning); endText.Position = (Vector2)endSprite.Position + new Vector2(20, 25); endText.CharacterSize = 40; finished = true; addScoreFromBots(); CheckLevel(); Logger.Instance.Write("\n" + "Rating: " + playerScore + "\n" + "Bronze: " + ratingNumbers[0] + "\n" + "Silber: " + ratingNumbers[1] + "\n" + "Gold: " + ratingNumbers[2] + "\n" + "Sie haben " + CheckLevel() + " erreicht", Logger.level.Info); } if (KeyboardInputManager.Upward(Keyboard.Key.Back)) { MusicManager.StopSound(); foreach (Tutorial tut in tutorials) { if (tut.index == curIndex) { tut.shown = false; } } mapStatus = 2; } guiLevelNumber.DisplayedString = "" + (curIndex + 1); } return(mapStatus); }