/// <summary> /// Handle scene exit /// </summary> public override void Exit() { RB.EffectReset(); RB.MapClear(); mSpriteSheet1.Unload(); mMap.Unload(); mShader1.Unload(); base.Exit(); }
/// <summary> /// Handle scene entry /// </summary> public override void Enter() { spriteSheet1.Load("Demos/DemoReel/Sprites"); spriteSheet1.grid = new SpriteGrid(new Vector2i(16, 16)); spriteSheet2.Create(RB.DisplaySize); RB.SpriteSheetSet(spriteSheet1); base.Enter(); }
/// <summary> /// Run the stress test /// </summary> protected override void StressTest() { Random.InitState(0); for (int i = 0; i < mStressLevel; i++) { var randPos = mRandomPos[i]; randPos += GetWiggle(); RB.DrawSprite(mRandomSprite[i], randPos); } }
/// <summary> /// Clear all options /// </summary> public void ClearOptions() { var game = (RetroDungeoneerGame)RB.Game; mOptionCount = 0; var headerSize = RB.PrintMeasure(game.assets.fontSmall, mHeader); headerSize.width += 32; mWidestOption = headerSize.width > MINIMUM_WIDTH ? headerSize.width : MINIMUM_WIDTH; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { RB ds = new RB(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public override void Render() { if (!isVisible) { return; } RB.AlphaSet(alpha); RB.TintColorSet(tintColor); RB.DrawSprite(sprite, pos); RB.TintColorSet(Color.white); RB.AlphaSet(255); }
/// <summary> /// Follow the given entity /// </summary> /// <param name="entity">Entity to follow</param> public void Follow(EntityID entity) { var e = EntityStore.Get(entity); if (e == null) { return; } mPos.x += ((e.pos.x * RB.SpriteSize(0).width) - mPos.x) * mSpeed; mPos.y += ((e.pos.y * RB.SpriteSize(0).height) - mPos.y) * mSpeed; }
/// <summary> /// Render the scene /// </summary> public override void Render() { RB.DrawSprite(S.TITLE_BACKGROUND, Vector2i.zero); int yOffset = Mathf.RoundToInt(Mathf.Sin(RB.Ticks / 16.0f) * 2); RB.TintColorSet(Color.black); RB.DrawSprite(S.TITLE_TEXT, new Vector2i(170, 15 + yOffset)); RB.TintColorSet(Color.white); RB.DrawSprite(S.TITLE_TEXT, new Vector2i(170, 12 + yOffset)); mMenuMain.Render(); }
/// <summary> /// Rotates the player based on current input /// </summary> void Rotate() { if (m_inputVector == Vector3.zero) { return; } float targetAngle = Mathf.Atan2(m_inputVector.x, m_inputVector.z) * Mathf.Rad2Deg; m_smoothAngle = Mathf.LerpAngle(m_smoothAngle, targetAngle, m_rotationSpeed * Time.deltaTime); RB.MoveRotation(Quaternion.Euler(Vector3.up * m_smoothAngle)); }
protected override void Jump() { if (Time.time > jumpDelay) { if (IsGrounded()) { jumpDelay = Time.time + jumpCooldown; RB.AddForce(new Vector2(0, jumpStrength), ForceMode2D.Impulse); characterAnim.SetBool("IsJumping", true); } } }
private void DrawAlign(int x, int y) { var demo = (DemoReel)RB.Game; RB.CameraSet(new Vector2i(-x, -y - 25)); mDialogStr.Set("\u30B3\u30F3\u30CB\u30C1\u30EF\n@dbab77RetroBlit@- supports\nunicode fonts!"); var textRect = new Rect2i(2, 12, 96, 48); DrawTextFrame(textRect, DemoUtil.HighlightCode(mFormatStr.Set("alignFlags = \n@[email protected]_H_LEFT | @[email protected]_V_TOP"), mFinalStr)); RB.Print(textRect, DemoUtil.IndexToRGB(4), RB.ALIGN_H_LEFT | RB.ALIGN_V_TOP, mDialogStr); textRect = new Rect2i(112, 12, 96, 48); DrawTextFrame(textRect, DemoUtil.HighlightCode(mFormatStr.Set("alignFlags = \n@[email protected]_H_CENTER | @[email protected]_V_TOP"), mFinalStr)); RB.Print(textRect, DemoUtil.IndexToRGB(4), RB.ALIGN_H_CENTER | RB.ALIGN_V_TOP, mDialogStr); textRect = new Rect2i(222, 12, 96, 48); DrawTextFrame(textRect, DemoUtil.HighlightCode(mFormatStr.Set("alignFlags = \n@[email protected]_H_RIGHT | @[email protected]_V_TOP"), mFinalStr)); RB.Print(textRect, DemoUtil.IndexToRGB(4), RB.ALIGN_H_RIGHT | RB.ALIGN_V_TOP, mDialogStr); textRect = new Rect2i(2, 112, 96, 48); DrawTextFrame(textRect, DemoUtil.HighlightCode(mFormatStr.Set("alignFlags = \n@[email protected]_H_LEFT | @[email protected]_V_CENTER"), mFinalStr)); RB.Print(textRect, DemoUtil.IndexToRGB(4), RB.ALIGN_H_LEFT | RB.ALIGN_V_CENTER, mDialogStr); textRect = new Rect2i(112, 112, 96, 48); DrawTextFrame(textRect, DemoUtil.HighlightCode(mFormatStr.Set("alignFlags = \n@[email protected]_H_CENTER | @[email protected]_V_CENTER"), mFinalStr)); RB.Print(textRect, DemoUtil.IndexToRGB(4), RB.ALIGN_H_CENTER | RB.ALIGN_V_CENTER, mDialogStr); textRect = new Rect2i(222, 112, 96, 48); DrawTextFrame(textRect, DemoUtil.HighlightCode(mFormatStr.Set("alignFlags = \n@[email protected]_H_RIGHT | @[email protected]_V_CENTER"), mFinalStr)); RB.Print(textRect, DemoUtil.IndexToRGB(4), RB.ALIGN_H_RIGHT | RB.ALIGN_V_CENTER, mDialogStr); textRect = new Rect2i(2, 212, 96, 48); DrawTextFrame(textRect, DemoUtil.HighlightCode(mFormatStr.Set("alignFlags = \n@[email protected]_H_LEFT | @[email protected]_V_BOTTOM"), mFinalStr)); RB.Print(textRect, DemoUtil.IndexToRGB(4), RB.ALIGN_H_LEFT | RB.ALIGN_V_BOTTOM, mDialogStr); textRect = new Rect2i(112, 212, 96, 48); DrawTextFrame(textRect, DemoUtil.HighlightCode(mFormatStr.Set("alignFlags = \n@[email protected]_H_CENTER | @[email protected]_V_BOTTOM"), mFinalStr)); RB.Print(textRect, DemoUtil.IndexToRGB(4), RB.ALIGN_H_CENTER | RB.ALIGN_V_BOTTOM, mDialogStr); textRect = new Rect2i(222, 212, 96, 48); DrawTextFrame(textRect, DemoUtil.HighlightCode(mFormatStr.Set("alignFlags = \n@[email protected]_H_RIGHT | @[email protected]_V_BOTTOM"), mFinalStr)); RB.Print(textRect, DemoUtil.IndexToRGB(4), RB.ALIGN_H_RIGHT | RB.ALIGN_V_BOTTOM, mDialogStr); mFormatStr.Set("@C// Print text within a text rectangle, with specific alignment\n"); mFormatStr.Append("@[email protected](@Knew @MRect2i@N(@L8@N, @L8@N, @L96@N, @L48@N), alignFlags,\n"); mFormatStr.Append(" @S\"\u30B3\u30F3\u30CB\u30C1\u30EF\\n@@dbab77RetroBlit@@- supports\\nunicode fonts!\"@N);"); RB.CameraReset(); RB.Print(new Vector2i(x, y), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr)); }
private void DrawCode(int x, int y) { var demo = (DemoReel)RB.Game; mFormatStr.Set("@C// Interpolate between integers, floats, colors, vectors, and more using RetroBlit easing functions!\n"); mFormatStr.Append("@Kint@N num = @[email protected](@MEase@N.@[email protected], @L10@N, @L20@N, @L0.5f@N);\n"); mFormatStr.Append("@KColor@N color = @[email protected](@MEase@N.@[email protected], @[email protected], @[email protected], @L0.75f@N);\n"); mFormatStr.Append("@KVector2i@N vec = @[email protected](@MEase@N.@[email protected], @Knew@N @MVector2i@N(@L0@N, @L0@N), @Knew@N @MVector2i@N(@L-5@N, @L-8@N), @L0.33f@N);\n"); mFormatStr.Append("@KRect2i@N rect = @[email protected](@MEase@N.@[email protected], @Knew@N @MRect2i@N(@L5@N, @L5@N, @L10@N, @L10@N), @Knew@N @MRect2i@N(@L0@N, @L0@N, @L5@N, @L5@N), @L0.1f@N);\n"); RB.Print(new Vector2i(x, y), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr)); }
private void DrawCode(int x, int y) { var demo = (DemoReel)RB.Game; RB.Print(new Vector2i(x, y), DemoUtil.IndexToRGB(5), "Source code:"); RB.DrawRectFill(new Rect2i(x, y + 10, 315, 270), DemoUtil.IndexToRGB(1)); mFormatStr.Set(mMarkedUpCode); DemoUtil.HighlightCode(mFormatStr, mFinalStr); RB.Print(new Vector2i(x + 4, y + 14), DemoUtil.IndexToRGB(5), mFinalStr); }
private bool AnyPlayerKeyDown() { for (int i = 0; i < PlayerKeyCodes.Length; i++) { if (RB.KeyDown(PlayerKeyCodes[i])) { return(true); } } return(false); }
/// <summary> /// Render /// </summary> public override void Render() { var demo = (DemoReel)RB.Game; RB.Clear(DemoUtil.IndexToRGB(1)); int x = 4; int y = 4; DrawClip(x, y); DrawOffscreen(x + 320, y); }
/// <summary> /// Update scene /// </summary> /// <returns>True if update consumed</returns> public override bool Update() { // If game is not ready for some reason then bail out to Main Menu if (!mGameReady) { var game = (RetroDungeoneerGame)RB.Game; game.ChangeScene(SceneEnum.MAIN_MENU); return(false); } if (mFOVRecompute) { mGameMap.RecomputeFov(mPlayer, C.FOV_RADIUS); mFOVRecompute = false; } if (mFloodRecompute) { mFloodMap.Refresh(mPlayer.e.pos, (C.SCREEN_WIDTH / 2) + 2); mFloodRecompute = false; } if (mGameState == GameState.ENEMY_TURN) { DoEnemyTurn(); ChangeState(GameState.PLAYER_TURN); } else { if (!mInputLocked && DoPlayerTurn()) { if (mGameState != GameState.LEVEL_UP) { ChangeState(GameState.ENEMY_TURN); } } } mCamera.Follow(mPlayer); RenderFunctions.Update(); SoundBank.Instance.Process(); EffectManager.Instance.Update(mResultSet); HandleEffectResults(); if (mInputLocked && !RB.AnyKeyDown()) { mInputLocked = false; } return(false); }
public string get_resource_building_info() { string text = ""; //resource buildiing info foreach (ResourceBuilding RB in resource_buildings) { text += RB.ToString(); text += Environment.NewLine; } return(text); }
private void DrawPiano(int x, int y) { var demo = (DemoReel)RB.Game; RB.CameraSet(new Vector2i(-x, -y)); mFormatStr.Set("@C// Play sound at specific volume and pitch\n"); mFormatStr.Append("@NsoundC5Note.Load(@S\"Demos/Demo/C5Note\"@N);\n"); mFormatStr.Append("@[email protected](soundC5Note, @L0.@L5f@N, @L1.@L2f@N);\n"); RB.Print(new Vector2i(0, 0), DemoUtil.IndexToRGB(5), DemoUtil.HighlightCode(mFormatStr, mFinalStr)); RB.CameraSet(new Vector2i(-x, -y - 35)); Rect2i pianoRect = mPianoRect; Rect2i holeRect = pianoRect; pianoRect = pianoRect.Expand(8); holeRect = holeRect.Expand(2); int cornerSize = 8; RB.DrawEllipseFill(new Vector2i(pianoRect.x + cornerSize, pianoRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3)); RB.DrawEllipse(new Vector2i(pianoRect.x + cornerSize, pianoRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2)); RB.DrawEllipseFill(new Vector2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3)); RB.DrawEllipse(new Vector2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + cornerSize), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2)); RB.DrawEllipseFill(new Vector2i(pianoRect.x + cornerSize, pianoRect.y + pianoRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3)); RB.DrawEllipse(new Vector2i(pianoRect.x + cornerSize, pianoRect.y + pianoRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2)); RB.DrawEllipseFill(new Vector2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + pianoRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(3)); RB.DrawEllipse(new Vector2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + pianoRect.height - cornerSize - 1), new Vector2i(cornerSize, cornerSize), DemoUtil.IndexToRGB(2)); RB.DrawRect(new Rect2i(pianoRect.x + cornerSize, pianoRect.y, pianoRect.width - (cornerSize * 2), pianoRect.height), DemoUtil.IndexToRGB(2)); RB.DrawRectFill(new Rect2i(pianoRect.x + cornerSize, pianoRect.y + 1, pianoRect.width - (cornerSize * 2), pianoRect.height - 2), DemoUtil.IndexToRGB(3)); RB.DrawRect(new Rect2i(pianoRect.x, pianoRect.y + cornerSize, cornerSize, pianoRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(2)); RB.DrawRectFill(new Rect2i(pianoRect.x + 1, pianoRect.y + cornerSize, cornerSize - 1, pianoRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(3)); RB.DrawRect(new Rect2i(pianoRect.x + pianoRect.width - cornerSize, pianoRect.y + cornerSize, cornerSize, pianoRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(2)); RB.DrawRectFill(new Rect2i(pianoRect.x + pianoRect.width - cornerSize - 1, pianoRect.y + cornerSize, cornerSize, pianoRect.height - (cornerSize * 2)), DemoUtil.IndexToRGB(3)); RB.DrawRectFill(holeRect, DemoUtil.IndexToRGB(2)); for (int i = 0; i < mPianoButtons.Length; i++) { mPianoButtons[i].Render(); } RB.CameraReset(); }
private void DrawTilemap(int x, int y) { var demo = (DemoReel)RB.Game; RB.Offscreen(spriteSheet1); RB.SpriteSheetSet(spriteSheet2); mWaveOffset = (int)((RB.Ticks / 2) % 16); mFishFrame = (int)((RB.Ticks / 6) % 32); RB.DrawCopy(new Rect2i(mWaveOffset, 0, RB.SpriteSheetGet().grid.cellSize), new Vector2i(48, 192)); RB.Clear(new Color32(0, 0, 0, 0), new Rect2i(80, 192, RB.SpriteSheetGet().grid.cellSize)); if (mFishFrame < 7) { RB.DrawCopy(new Rect2i(mFishFrame * RB.SpriteSheetGet().grid.cellSize.width, RB.SpriteSheetGet().grid.cellSize.height, RB.SpriteSheetGet().grid.cellSize), new Vector2i(80, 192)); } RB.Onscreen(); Rect2i clipRect = new Rect2i(x, y + (RB.DisplaySize.height / 2) - 8, 632, 180); if (mMap != null) { RB.ClipSet(clipRect); RB.DrawRectFill(clipRect, DemoUtil.IndexToRGB(22)); RB.CameraSet(new Vector2i(0, 0)); RB.DrawMapLayer(2); RB.DrawMapLayer(3); RB.TintColorSet(Color.black); RB.AlphaSet(32); int scrollPos = -(int)RB.Ticks % (mMap.size.width * RB.SpriteSheetGet().grid.cellSize.width); RB.DrawMapLayer(1, new Vector2i(scrollPos + 8, 8)); RB.DrawMapLayer(1, new Vector2i(scrollPos + (mMap.size.width * RB.SpriteSheetGet().grid.cellSize.width) + 8, 8)); RB.TintColorSet(Color.white); RB.AlphaSet(196); RB.DrawMapLayer(1, new Vector2i(scrollPos, 0)); RB.DrawMapLayer(1, new Vector2i(scrollPos + (mMap.size.width * RB.SpriteSheetGet().grid.cellSize.width), 0)); RB.AlphaSet(255); RB.CameraReset(); RB.ClipReset(); RB.SpriteSheetSet(spriteSheet1); } else { RB.Print(new Vector2i(clipRect.x + 2, clipRect.y + 2), DemoUtil.IndexToRGB(14), "Failed to load TMX map.\nPlease try re-importing the map Demos/DemoReel/TilemapOcean.tmx in Unity"); } RB.DrawRect(clipRect, DemoUtil.IndexToRGB(21)); }
private void HandleLevelUpKeys(ResultSet resultSet) { if (RB.ButtonPressed(RB.BTN_SYSTEM)) { resultSet.AddExit(); return; } int index = -1; for (char i = 'a'; i <= 'c'; i++) { if (RB.KeyPressed((KeyCode)i)) { index = (int)(i - 'a'); break; } } // Check if pointer clicked on any of the items if (RB.ButtonReleased(RB.BTN_POINTER_A)) { if (mMenuInventory.pointerIndex >= 0 && mMenuInventory.pointerIndex <= 2) { index = mMenuInventory.pointerIndex; } } LevelUp levelUp = LevelUp.None; if (index >= 0 && index <= 2) { switch (index) { case 0: levelUp = LevelUp.Hp; break; case 1: levelUp = LevelUp.Str; break; case 2: levelUp = LevelUp.Def; break; } resultSet.AddLevelUp(levelUp); RB.SoundPlay(C.SOUND_SELECT_OPTION, 1, RandomUtils.RandomPitch(0.1f)); } }
private void DrawTextFrame(Rect2i rect, FastString subTitle) { var demo = (DemoReel)RB.Game; RB.DrawRectFill(rect, DemoUtil.IndexToRGB(1)); RB.DrawRect(rect, DemoUtil.IndexToRGB(2)); if (subTitle != null) { var subTitleRect = new Rect2i(rect.x, rect.y + rect.height + 5, rect.width, rect.height); RB.Print(subTitleRect, DemoUtil.IndexToRGB(3), RB.ALIGN_H_CENTER | RB.TEXT_OVERFLOW_WRAP, subTitle); } }
/// <summary> /// Update /// </summary> public void Update() { if (RB.ButtonPressed(RB.BTN_POINTER_A)) { var game = (BrickBustGame)RB.Game; game.ChangeState(BrickBustGame.GameState.LEVEL); } for (int i = 0; i < mBlobs.Count; i++) { mBlobs[i].Update(); } }
private void DrawSpinner(int x, int y, int spinnerSize) { var demo = (DemoReel)RB.Game; RB.DrawEllipseFill(new Vector2i(x + spinnerSize, y + spinnerSize), new Vector2i(spinnerSize, spinnerSize), DemoUtil.IndexToRGB(1)); RB.DrawEllipseFill(new Vector2i(x + spinnerSize, y + spinnerSize), new Vector2i(spinnerSize - 6, spinnerSize - 6), DemoUtil.IndexToRGB(4)); RB.DrawEllipseFill(new Vector2i(x + spinnerSize, y + spinnerSize), new Vector2i(8, 8), DemoUtil.IndexToRGB(1)); RB.DrawEllipse(new Vector2i(x + spinnerSize, y + spinnerSize), new Vector2i(spinnerSize, spinnerSize), DemoUtil.IndexToRGB(4)); RB.SpriteSheetSet(mSpriteSheet2); RB.DrawCopy(new Rect2i(0, 0, (spinnerSize * 2) + 1, (spinnerSize * 2) + 1), new Rect2i(x, y, (spinnerSize * 2) + 1, (spinnerSize * 2) + 1), new Vector2i(spinnerSize, spinnerSize), mMusicTicks / 50); RB.SpriteSheetSet(mSpriteSheet1); }
private void HandlePlayerDeadKeys(ResultSet resultSet) { if (RB.ButtonPressed(RB.BTN_SYSTEM)) { resultSet.AddExit(); return; } if (RB.KeyPressed(KeyCode.P)) { resultSet.AddShowCharacterScreen(); } }
/// <summary> /// Perform a jump /// </summary> public void Jump() { mJumped = false; if (mIsOnGround) { // Adjust the jump force by horizontal velocity, the faster the higher the jump var jumpForce = ((Mathf.Abs(mFVel.x) / MoveSpeed) * (MaxJumpForce - MinJumpForce)) + MinJumpForce; mFVel.y = -jumpForce; mJumped = true; RB.SoundPlay(SuperFlagRun.SOUND_JUMP, 0.5f, Random.Range(0.9f, 1.1f)); } }
/// <summary> /// Handle scene entry /// </summary> public override void Enter() { base.Enter(); spriteSheet1.Load("Demos/DemoReel/Sprites"); spriteSheet1.grid = new SpriteGrid(new Vector2i(16, 16)); RB.SpriteSheetSet(spriteSheet1); var demo = (DemoReel)RB.Game; font.Setup('A', 'Z', new Vector2i(0, 16), spriteSheet1, new Vector2i(12, 12), 10, 1, 2, false); }
/// <summary> /// Render, your drawing code should go here. /// </summary> public void Render() { RB.Clear(new Color32(24, 17, 7, 255)); if (mState == GameState.MAIN_MENU) { mMainMenu.Render(); } else if (mState == GameState.LEVEL) { mLevel.Render(); } }
/// <summary> /// Render /// </summary> public override void Render() { var demo = (DemoReel)RB.Game; RB.Clear(DemoUtil.IndexToRGB(1)); int x = 4; int y = 12; DrawCode(x, y); DrawFire(); }
/// <summary> /// Setup a custom font from the sprite sheet. /// </summary> /// <remarks>The glyphs in your sprite sheet should be organized into a grid, with each cell size being the same. If <paramref name="monospaced"/> is false then RetroBlit will automatically trim any /// horizontal empty space on either side of the glyph. If <paramref name="monospaced"/> is true then the empty space is retained.</remarks> /// <param name="unicodeStart">First unicode character in the font</param> /// <param name="unicodeEnd">Last unicode character in the font</param> /// <param name="glyphSprites">List of packed sprite names to use for the glyphs</param> /// <param name="spriteSheet">The sprite sheet containing the font</param> /// <param name="characterSpacing">Spacing between characters</param> /// <param name="lineSpacing">Line spacing between lines of text</param> /// <param name="monospaced">True if font is monospaced</param> /// <returns>Setup status</returns> public RB.AssetStatus Setup(char unicodeStart, char unicodeEnd, List <string> glyphSprites, SpriteSheetAsset spriteSheet, int characterSpacing, int lineSpacing, bool monospaced) { InternalSetErrorStatus(RB.AssetStatus.Failed, RB.Result.BadParam); progress = 0; if (unicodeStart < 0 || unicodeEnd < unicodeStart) { Debug.LogError("Invalid unicode range"); return(status); } if (spriteSheet == null) { Debug.LogError("Invalid sprite sheet"); return(status); } if (spriteSheet.status != RB.AssetStatus.Ready) { Debug.LogError("Sprite sheet is not ready or not loaded"); return(status); } if (glyphSprites == null) { Debug.LogError("Glyph sprites list is null!"); return(status); } if ((unicodeEnd - unicodeStart + 1) != glyphSprites.Count) { Debug.LogError("Expected " + (unicodeEnd - unicodeStart + 1) + " glyph sprites to cover the given unicode range, was given " + glyphSprites.Count + " glyph sprites"); return(status); } var glyphSprites2 = new List <PackedSprite>(glyphSprites.Count); for (int i = 0; i < glyphSprites.Count; i++) { glyphSprites2.Add(RB.PackedSpriteGet(glyphSprites[i], spriteSheet)); } RetroBlitInternal.RBAPI.instance.Font.FontSetup(this, unicodeStart, unicodeEnd, null, glyphSprites2, spriteSheet, characterSpacing, lineSpacing, monospaced, true); InternalSetErrorStatus(RB.AssetStatus.Ready, RB.Result.Success); progress = 1; return(status); }
//Hold all movement controls -NG private void HorizontalMovement() { if (Input.GetKey(left)) { if (iceCheck) { RB.AddForce(new Vector2(-moveSpeed * 0.8f, RB.velocity.y), ForceMode2D.Force); } else { RB.velocity = new Vector2(-moveSpeed, RB.velocity.y); } } else if (Input.GetKey(right)) { if (iceCheck) { RB.AddForce(new Vector2(moveSpeed * 0.8f, RB.velocity.y), ForceMode2D.Force); } else { RB.velocity = new Vector2(moveSpeed, RB.velocity.y); } } else { if (iceCheck) { RB.velocity = new Vector2(RB.velocity.x * iceSlide, RB.velocity.y); } if (iceLaunch.Launching) { Debug.Log("Launching the player"); if (iceLaunch.LaunchRight == true) { RB.velocity = new Vector2(iceLaunch.LaunchPower.x, iceLaunch.LaunchPower.y); } else if (iceLaunch.LaunchRight == false) { RB.velocity = new Vector2(-iceLaunch.LaunchPower.x, iceLaunch.LaunchPower.y); } } else { RB.velocity = new Vector2(0, RB.velocity.y); } } }