Table of Contents

Class TimbnBubble

Namespace
Timbn.GraveyardKeeperTwo.Core.Framework
Assembly
Timbn.GraveyardKeeperTwo.Core.dll

An icon over a spot in the world, with no key or text, the way the game marks a workstation that needs something. Use it to show what someone wants, such as a beer over a customer's head. By default it sits in the game's small square frame. Set Framed to false for the bare icon, Scale to size it and Tint to color it. Get one from the plugin's UI.CreateBubble, move it with Show as often as you like, and it is hidden when the plugin unloads or the player returns to the main menu. Dispose a bubble the plugin is done with, such as one made per customer.

public sealed class TimbnBubble : IBubbleDrawable, IDisposable
Inheritance
TimbnBubble
Implements
IBubbleDrawable
Inherited Members

Examples

_wants = UI.CreateBubble();
_wants.Framed = false;
_wants.Scale = 0.6f;
// as their patience runs out
_wants.Tint = Color.Lerp(Color.white, Color.red, waited / patience);
// every frame the customer waits
_wants.Show(customer.Position + Vector3.up * 1.6f, "i_cup_beer");
// once they are served
_wants.Hide();

Properties

Framed

Whether the icon sits in the game's small square frame. True by default.

public bool Framed { get; set; }

Property Value

bool

IsVisible

Whether the bubble is on screen.

public bool IsVisible { get; }

Property Value

bool

Scale

How big the icon is drawn, where 1 is the game's own size. 1 by default.

public float Scale { get; set; }

Property Value

float

Tint

The color the icon is multiplied by, white for its own colors. Its alpha fades the icon, so 0 hides it while the bubble keeps its place. Changing it every frame is cheap, so it suits a fade or a flash.

public Color Tint { get; set; }

Property Value

Color

Methods

Dispose()

Hides the bubble and lets the plugin forget it. It can still be shown again afterwards, but nothing hides it for the plugin any more.

public void Dispose()

Hide()

Takes the bubble off the screen. It does nothing when the bubble is not showing.

public void Hide()

Show(Vector3, string, bool)

Shows the bubble, or moves it and changes its icon if it is already showing. Calling it every frame with the same values costs nothing.

public void Show(Vector3 position, string iconId, bool crossedOut = false)

Parameters

position Vector3

The spot in the world to draw it over.

iconId string

The icon, such as an item's i_cup_beer or one added with Sprites.AddPng.

crossedOut bool

Draws a red line through the icon, such as for a wish that went unmet.