4 using Microsoft.Xna.Framework;
5 using Microsoft.Xna.Framework.Graphics;
7 using System.Collections.Generic;
14 const float BossHealthBarDuration = 120.0f;
16 abstract class BossProgressBar
18 public float FadeTimer;
26 public abstract bool Completed {
get; }
28 public abstract bool Interrupted {
get; }
30 public abstract float State {
get; }
32 public abstract string NumberToDisplay {
get; }
34 public abstract Color Color {
get; }
38 FadeTimer = BossHealthBarDuration;
42 MinSize = new Point(100, 50),
43 RelativeOffset = new Vector2(0.0f, 0.01f)
44 }, isHorizontal:
false, childAnchor:
Anchor.TopCenter);
45 new GUITextBlock(
new RectTransform(
new Vector2(1.0f, 0.4f), TopContainer.RectTransform), label, textAlignment: Alignment.Center, textColor: GUIStyle.Red);
48 MinSize = new Point(100, HUDLayoutSettings.HealthBarArea.Size.Y)
49 }, barSize: 0.0f, style:
"CharacterHealthBarCentered")
53 CreateNumberText(TopHealthBar);
57 MinSize = new Point(80, 60)
58 }, isHorizontal:
false, childAnchor:
Anchor.TopRight);
59 new GUITextBlock(
new RectTransform(
new Vector2(1.0f, 0.3f), SideContainer.RectTransform), label, textAlignment: Alignment.CenterRight, textColor: GUIStyle.Red);
60 SideHealthBar =
new GUIProgressBar(
new RectTransform(
new Vector2(1.0f, 0.7f), SideContainer.RectTransform), barSize: 0.0f, style:
"CharacterHealthBar")
64 CreateNumberText(SideHealthBar);
66 TopContainer.Visible = SideContainer.Visible =
false;
67 TopContainer.CanBeFocused =
false;
68 TopContainer.Children.ForEach(c => c.CanBeFocused =
false);
69 SideContainer.CanBeFocused =
false;
70 SideContainer.Children.ForEach(c => c.CanBeFocused =
false);
75 { AbsoluteOffset = new Point(2) },
76 string.Empty, textAlignment: Alignment.Center, textColor: GUIStyle.TextColorDark)
78 TextGetter = () => NumberToDisplay
81 string.Empty, textAlignment: Alignment.Center, textColor: GUIStyle.TextColorBright)
83 TextGetter = () => NumberToDisplay
88 public abstract bool IsDuplicate(
object targetObject);
91 class BossHealthBar : BossProgressBar
101 public override Color Color =>
103 GUIStyle.HealthBarColorPoisoned : GUIStyle.Red;
105 public override string NumberToDisplay =>
string.Empty;
112 public override bool IsDuplicate(
object targetObject)
118 class MissionProgressBar : BossProgressBar
128 public override Color Color => GUIStyle.Red;
131 $
"{Mission.State}/{Mission.Prefab.MaxProgressState}" :
139 public override bool IsDuplicate(
object targetObject)
145 private static readonly Dictionary<ISpatialEntity, int> orderIndicatorCount =
new Dictionary<ISpatialEntity, int>();
146 const float ItemOverlayDelay = 1.0f;
147 private static Item focusedItem;
148 private static float focusedItemOverlayTimer;
150 private static readonly List<Item> brokenItems =
new List<Item>();
151 private static float brokenItemsCheckTimer;
153 private static readonly List<BossProgressBar> bossProgressBars =
new List<BossProgressBar>();
155 private static readonly Dictionary<Identifier, LocalizedString> cachedHudTexts =
new Dictionary<Identifier, LocalizedString>();
166 if (hudFrame ==
null)
174 RelativeOffset = new Vector2(0.005f, 0.0f)
177 AbsoluteSpacing = GUI.IntScale(10)
185 private static bool lastHudTextsContextual;
186 private static float timeHealthWindowClosed;
206 if (cachedHudTextLanguage != GameSettings.CurrentConfig.Language)
208 cachedHudTexts.Clear();
210 Identifier key = (textTag + keyBind + GameSettings.CurrentConfig.KeyMap.KeyBindText(keyBind)).ToIdentifier();
211 if (cachedHudTexts.TryGetValue(key, out
LocalizedString text)) {
return text; }
212 text = TextManager.GetWithVariable(textTag,
"[key]", GameSettings.CurrentConfig.KeyMap.KeyBindText(keyBind)).Value;
213 cachedHudTexts.Add(key, text);
214 cachedHudTextLanguage = GameSettings.CurrentConfig.Language;
220 if (GUI.DisableHUD) {
return; }
254 if (character.
Inventory !=
null && !LockInventory(character))
263 InteractionLabelManager.Update(character, cam);
280 if (!LockInventory(character))
302 if (focusedItem !=
null)
306 focusedItemOverlayTimer = Math.Min(focusedItemOverlayTimer + deltaTime, ItemOverlayDelay + 1.0f);
310 focusedItemOverlayTimer = Math.Max(focusedItemOverlayTimer - deltaTime, 0.0f);
311 if (focusedItemOverlayTimer <= 0.0f)
319 if (brokenItemsCheckTimer > 0.0f)
321 brokenItemsCheckTimer -= deltaTime;
326 brokenItemsCheckTimer = 1.0f;
330 if (!item.
Repairables.Any(r => r.IsBelowRepairIconThreshold)) {
continue; }
336 brokenItems.Add(item);
343 timeHealthWindowClosed = 0.0f;
347 timeHealthWindowClosed += deltaTime;
353 if (GUI.DisableHUD) {
return; }
359 orderIndicatorCount.Clear();
362 if (!DrawIcon(activeOrder.Order)) {
continue; }
364 if (activeOrder.FadeOutTime.HasValue)
366 DrawOrderIndicator(spriteBatch, cam, character, activeOrder.Order, iconAlpha: MathHelper.Clamp(activeOrder.FadeOutTime.Value / 10.0f, 0.2f, 1.0f));
370 float iconAlpha = GetDistanceBasedIconAlpha(activeOrder.Order.TargetSpatialEntity, maxDistance: 450.0f);
371 if (iconAlpha <= 0.0f) {
continue; }
372 DrawOrderIndicator(spriteBatch, cam, character, activeOrder.Order,
373 iconAlpha: iconAlpha, createOffset:
false, scaleMultiplier: 0.5f, overrideAlpha:
true);
379 DrawOrderIndicator(spriteBatch, cam, character, currentOrder, 1.0f);
382 static bool DrawIcon(
Order o) =>
386 i.GetRootInventoryOwner() == i);
393 if (!mission.DisplayTargetHudIcons) {
continue; }
394 foreach (var target
in mission.HudIconTargets)
396 if (target.Submarine != character.
Submarine) {
continue; }
397 float alpha = GetDistanceBasedIconAlpha(target, maxDistance: mission.Prefab.HudIconMaxDistance);
398 if (alpha <= 0.0f) {
continue; }
399 GUI.DrawIndicator(spriteBatch, target.DrawPosition, cam, 100.0f, mission.Prefab.HudIcon, mission.Prefab.HudIconColor * alpha);
406 DrawObjectiveIndicator(spriteBatch, cam, character, objectiveEntity, 1.0f);
409 foreach (
Item brokenItem
in brokenItems)
412 float alpha = GetDistanceBasedIconAlpha(brokenItem);
413 if (alpha <= 0.0f) {
continue; }
414 GUI.DrawIndicator(spriteBatch, brokenItem.
DrawPosition, cam, 100.0f, GUIStyle.BrokenIcon.Value.Sprite,
415 Color.Lerp(GUIStyle.Red, GUIStyle.Orange * 0.5f, brokenItem.
Condition / brokenItem.
MaxCondition) * alpha);
425 float alpha = GetDistanceBasedIconAlpha(deconstructItem, maxDistance: 450) * 0.7f;
426 if (alpha <= 0.0f) {
continue; }
427 GUI.DrawIndicator(spriteBatch, deconstructItem.
DrawPosition, cam, 100.0f, deconstructOrder.SymbolSprite,
428 GUIStyle.Red, scaleMultiplier: 0.5f, overrideAlpha: alpha);
432 float GetDistanceBasedIconAlpha(
ISpatialEntity target,
float maxDistance = 1000.0f)
434 float dist = Vector2.Distance(character.WorldPosition, target.
WorldPosition);
435 return Math.Min((maxDistance - dist) / maxDistance * 2.0f, 1.0f);
438 if (!character.IsIncapacitated && character.Stun <= 0.0f && !
IsCampaignInterfaceOpen && (!character.IsKeyDown(
InputType.Aim) || character.HeldItems.None(it => it?.GetComponent<
Sprayer>() !=
null)))
440 if (!character.ShowInteractionLabels)
442 if (character.FocusedCharacter is { CanBeSelected: true })
444 DrawCharacterHoverTexts(spriteBatch, cam, character);
447 if (character.FocusedItem !=
null)
449 if (focusedItem != character.FocusedItem)
451 focusedItemOverlayTimer = Math.Min(1.0f, focusedItemOverlayTimer);
454 focusedItem = character.FocusedItem;
457 if (focusedItem !=
null && focusedItemOverlayTimer > ItemOverlayDelay)
459 Vector2 circlePos = cam.WorldToScreen(focusedItem.
DrawPosition);
460 float circleSize = Math.Max(focusedItem.
Rect.Width, focusedItem.
Rect.Height) * 1.5f;
461 circleSize = MathHelper.Clamp(circleSize, 45.0f, 100.0f) * Math.Min((focusedItemOverlayTimer - 1.0f) * 5.0f, 1.0f);
462 if (circleSize > 0.0f)
464 Vector2 scale =
new Vector2(circleSize / GUIStyle.FocusIndicator.FrameSize.X);
465 GUIStyle.FocusIndicator.Draw(spriteBatch,
466 (
int)((focusedItemOverlayTimer - 1.0f) * GUIStyle.FocusIndicator.FrameCount * 3.0f),
468 Color.LightBlue * 0.3f,
469 origin: GUIStyle.FocusIndicator.FrameSize.ToVector2() / 2,
470 rotate: (
float)Timing.TotalTime,
480 lastHudTextsContextual = hudTextsContextual;
485 int dir = Math.Sign(focusedItem.
WorldPosition.X - character.WorldPosition.X);
487 Vector2 textSize = GUIStyle.Font.MeasureString(hudTexts.First().Text);
488 Vector2 largeTextSize = GUIStyle.SubHeadingFont.MeasureString(hudTexts.First().Text);
490 Vector2 startPos = cam.WorldToScreen(focusedItem.
DrawPosition);
491 startPos.Y -= (hudTexts.Count + 1) * textSize.Y;
492 if (focusedItem.
Sprite !=
null)
494 startPos.X += (int)(circleSize * 0.4f * dir);
495 startPos.Y -= (int)(circleSize * 0.4f);
498 Vector2 textPos = startPos;
499 if (dir == -1) { textPos.X -= largeTextSize.X; }
501 float alpha = MathHelper.Clamp((focusedItemOverlayTimer - ItemOverlayDelay) * 2.0f, 0.0f, 1.0f);
503 GUI.DrawString(spriteBatch, textPos, hudTexts.First().Text, hudTexts.First().Color * alpha, Color.Black * alpha * 0.7f, 2, font: GUIStyle.SubHeadingFont,
ForceUpperCase.No);
504 startPos.X += dir * 10.0f * GUI.Scale;
505 textPos.X += dir * 10.0f * GUI.Scale;
506 textPos.Y += largeTextSize.Y;
507 foreach (
ColoredText coloredText
in hudTexts.Skip(1))
511 textPos.X = (int)(startPos.X - GUIStyle.SmallFont.MeasureString(coloredText.
Text).X);
513 GUI.DrawString(spriteBatch, textPos, coloredText.
Text, coloredText.
Color * alpha, Color.Black * alpha * 0.7f, 2, GUIStyle.SmallFont);
514 textPos.Y += textSize.Y;
520 if (character.ShowInteractionLabels && character.ViewTarget ==
null)
522 InteractionLabelManager.DrawLabels(spriteBatch, cam, character);
525 foreach (
HUDProgressBar progressBar
in character.HUDProgressBars.Values)
527 progressBar.
Draw(spriteBatch, cam);
530 void DrawInteractionIcon(
Entity entity, Identifier iconStyle)
532 if (entity ==
null || entity.
Removed) {
return; }
534 Hull currentHull = entity
switch
544 if (characterEntity.IsDead || characterEntity.IsIncapacitated) {
return; }
550 if (Vector2.DistanceSquared(character.Position, entity.
Position) > 500f * 500f) {
return; }
553 if (body !=
null && body.UserData != entity) {
return; }
555 visibleRange =
new Range<float>(-100f, 500f);
557 label = characterEntity?.Info?.Title;
560 if (GUIStyle.GetComponentStyle(iconStyle) is not
GUIComponentStyle style) {
return; }
562 float dist = Vector2.Distance(character.WorldPosition, entity.
WorldPosition);
563 float distFactor = 1.0f - MathUtils.InverseLerp(1000.0f, 3000.0f, dist);
564 float alpha = MathHelper.Lerp(0.3f, 1.0f, distFactor);
570 style.GetDefaultSprite(),
583 foreach (var (entity, iconStyle) in tutorialMode.Tutorial.Icons)
585 DrawInteractionIcon(entity, iconStyle);
592 if (Vector2.DistanceSquared(character.Position, item.
Position) > 500f * 500f) {
continue; }
594 if (body !=
null && body.UserData as
Item != item) {
continue; }
599 if (character.SelectedItem !=
null &&
602 character.SelectedItem.DrawHUD(spriteBatch, cam, character);
604 if (character.Inventory !=
null)
606 foreach (
Item item
in character.Inventory.AllItems)
608 if (character.HasEquippedItem(item))
610 item.
DrawHUD(spriteBatch, cam, character);
617 if (character.Inventory !=
null)
619 for (
int i = 0; i < character.Inventory.Capacity; i++)
621 var item = character.Inventory.GetItemAt(i);
622 if (item ==
null || character.Inventory.SlotTypes[i] ==
InvSlotType.Any) {
continue; }
624 bool duplicateFound =
false;
625 for (
int j = 0; j < i; j++)
627 if (character.Inventory.SlotTypes[j] !=
InvSlotType.Any && character.Inventory.GetItemAt(j) == item)
629 duplicateFound =
true;
633 if (duplicateFound) {
continue; }
641 bool mouseOnPortrait =
false;
642 if (character.Stun <= 0.1f && !character.IsDead)
647 if (character.Info !=
null && !character.ShouldLockHud())
649 character.Info.DrawBackground(spriteBatch);
650 character.Info.DrawJobIcon(spriteBatch,
652 (
int)(HUDLayoutSettings.BottomRightInfoArea.X + HUDLayoutSettings.BottomRightInfoArea.Width * 0.05f),
653 (
int)(HUDLayoutSettings.BottomRightInfoArea.Y + HUDLayoutSettings.BottomRightInfoArea.Height * 0.1f),
654 (
int)(HUDLayoutSettings.BottomRightInfoArea.Width / 2),
655 (
int)(HUDLayoutSettings.BottomRightInfoArea.Height * 0.7f)), character.Info.IsDisguisedAsAnother);
657 character.Info.DrawPortrait(spriteBatch, HUDLayoutSettings.PortraitArea.Location.ToVector2(),
new Vector2(-12 * GUI.Scale, yOffset), targetWidth: HUDLayoutSettings.PortraitArea.Width,
true, character.Info.IsDisguisedAsAnother);
658 character.Info.DrawForeground(spriteBatch);
663 GUIStyle.UIGlow.Draw(spriteBatch, HUDLayoutSettings.BottomRightInfoArea, GUIStyle.Green * 0.5f);
668 character.Inventory.Locked = character ==
Character.
Controlled && LockInventory(character);
669 character.Inventory.DrawOwn(spriteBatch);
676 if (!character.IsIncapacitated && character.Stun <= 0.0f)
678 if (character.Params.CanInteract && character.SelectedCharacter !=
null && character.SelectedCharacter.Inventory !=
null)
680 if (character.SelectedCharacter.IsInventoryAccessibleTo(character))
682 character.SelectedCharacter.Inventory.Locked =
false;
684 character.SelectedCharacter.Inventory.DrawOwn(spriteBatch);
688 character.SelectedCharacter.CharacterHealth.Alignment = Alignment.Left;
692 else if (character.Inventory !=
null)
702 character.Info?.Job ==
null ? character.DisplayName : character.DisplayName +
" (" + character.Info.Job.Name +
")",
703 HUDLayoutSettings.PortraitArea);
716 private static void DrawCharacterHoverTexts(SpriteBatch spriteBatch,
Camera cam,
Character character)
719 if (allItems !=
null)
721 foreach (
Item item
in allItems)
723 var statusHUD = item?.GetComponent<
StatusHUD>();
724 if (statusHUD !=
null && statusHUD.IsActive && statusHUD.VisibleCharacters.Contains(character.
FocusedCharacter))
736 Vector2 textPos = startPos;
737 Vector2 textSize = GUIStyle.Font.MeasureString(focusName);
738 Vector2 largeTextSize = GUIStyle.SubHeadingFont.MeasureString(focusName);
740 textPos -=
new Vector2(textSize.X / 2, textSize.Y);
743 GUI.DrawString(spriteBatch, textPos, focusName, nameColor, Color.Black * 0.7f, 2, GUIStyle.SubHeadingFont,
ForceUpperCase.No);
744 textPos.Y += GUIStyle.SubHeadingFont.MeasureString(focusName).Y;
753 textPos.X += 10.0f * GUI.Scale;
758 GUIStyle.Green, Color.Black, 2, GUIStyle.SmallFont);
759 textPos.Y += largeTextSize.Y;
764 string text = character.
CanEat ?
"EatHint" :
"GrabHint";
766 GUIStyle.Green, Color.Black, 2, GUIStyle.SmallFont);
767 textPos.Y += largeTextSize.Y;
773 GUIStyle.Green, Color.Black, 2, GUIStyle.SmallFont);
774 textPos.Y += textSize.Y;
779 textPos.Y += textSize.Y;
785 if (character ==
null || character.
IsDead || character.
Removed) {
return; }
786 if (bossProgressBars.Any(b => b.IsDuplicate(character))) {
return; }
787 AddBossProgressBar(
new BossHealthBar(character));
792 if (mission ==
null || mission.
Completed || mission.
Failed) {
return; }
793 if (bossProgressBars.Any(b => b.IsDuplicate(mission))) {
return; }
794 AddBossProgressBar(
new MissionProgressBar(mission));
799 for (
int i = bossProgressBars.Count - 1; i>= 0; i--)
801 RemoveBossProgressBar(bossProgressBars[i]);
803 bossProgressBars.Clear();
806 private static void RemoveBossProgressBar(BossProgressBar progressBar)
808 progressBar.SideContainer.Parent?.RemoveChild(progressBar.SideContainer);
809 progressBar.TopContainer.Parent?.RemoveChild(progressBar.TopContainer);
810 bossProgressBars.Remove(progressBar);
813 private static void AddBossProgressBar(BossProgressBar progressBar)
815 var healthBarMode = GameMain.NetworkMember?.ServerSettings.ShowEnemyHealthBars ?? GameSettings.CurrentConfig.ShowEnemyHealthBars;
820 if (bossProgressBars.Count > 5)
822 BossProgressBar oldestHealthBar = bossProgressBars.First();
823 foreach (var bar
in bossProgressBars)
825 if (bar.TopHealthBar.BarSize < oldestHealthBar.TopHealthBar.BarSize)
827 oldestHealthBar = bar;
830 oldestHealthBar.FadeTimer = Math.Min(oldestHealthBar.FadeTimer, 1.0f);
832 bossProgressBars.Add(progressBar);
837 var healthBarMode =
GameMain.
NetworkMember?.ServerSettings.ShowEnemyHealthBars ?? GameSettings.CurrentConfig.ShowEnemyHealthBars;
839 for (
int i = 0; i < bossProgressBars.Count; i++)
841 var bossHealthBar = bossProgressBars[i];
843 bool showTopBar = i == bossProgressBars.Count - 1;
844 if (showTopBar && !bossHealthBar.TopContainer.Visible)
846 bossHealthBar.SideContainer.SetAsLastChild();
847 SetColor(bossHealthBar, bossHealthBar.SideContainer, 0);
850 bossHealthBar.TopContainer.Visible = showTopBar;
851 bossHealthBar.SideContainer.Visible = !bossHealthBar.TopContainer.Visible;
853 bossHealthBar.TopHealthBar.BarSize = bossHealthBar.SideHealthBar.BarSize = bossHealthBar.State;
854 float alpha = Math.Min(bossHealthBar.FadeTimer, 1.0f);
856 if (bossHealthBar.TopContainer.Visible)
858 SetColor(bossHealthBar, bossHealthBar.TopContainer, alpha);
860 if (bossHealthBar.SideContainer.Visible)
862 SetColor(bossHealthBar, bossHealthBar.SideContainer, alpha);
865 static void SetColor(BossProgressBar bossHealthBar,
GUIComponent container,
float alpha)
869 component.Color =
new Color(bossHealthBar.Color, (
byte)(alpha * 255));
872 textBlock.TextColor =
new Color(bossHealthBar.Completed ? Color.Gray : textBlock.TextColor, (
byte)(alpha * 255));
877 if (bossHealthBar.Interrupted)
879 bossHealthBar.FadeTimer = Math.Min(bossHealthBar.FadeTimer, 1.0f);
881 else if (bossHealthBar.Completed)
883 bossHealthBar.FadeTimer = Math.Min(bossHealthBar.FadeTimer, 5.0f);
885 bossHealthBar.FadeTimer -= deltaTime;
887 for (
int i = bossProgressBars.Count - 1; i >= 0 ; i--)
889 var bossHealthBar = bossProgressBars[i];
892 bossHealthBar.SideContainer.Parent?.RemoveChild(bossHealthBar.SideContainer);
893 bossHealthBar.TopContainer.Parent?.RemoveChild(bossHealthBar.TopContainer);
894 bossProgressBars.RemoveAt(i);
900 private static bool LockInventory(
Character character)
907 private static void DrawOrderIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Order order,
908 float iconAlpha = 1.0f,
bool createOffset =
true,
float scaleMultiplier = 1.0f,
bool overrideAlpha =
false)
910 if (order?.SymbolSprite ==
null) {
return; }
911 if (order.IsReport && order.OrderGiver != character && !order.HasAppropriateJob(character)) {
return; }
913 ISpatialEntity target = order.ConnectedController?.Item ?? order.TargetSpatialEntity;
914 if (target ==
null) {
return; }
918 if (character.Submarine != target.Submarine &&
919 Vector2.DistanceSquared(character.WorldPosition, target.WorldPosition) > 1000.0f * 1000.0f)
924 if (!orderIndicatorCount.ContainsKey(target)) { orderIndicatorCount.Add(target, 0); }
926 Vector2 drawPos = target is Entity entity ? entity.DrawPosition :
927 target.Submarine ==
null ? target.Position : target.Position + target.Submarine.DrawPosition;
928 drawPos += Vector2.UnitX * order.SymbolSprite.size.X * 1.5f * orderIndicatorCount[target];
929 GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, order.SymbolSprite, order.Color * iconAlpha,
930 createOffset: createOffset, scaleMultiplier: scaleMultiplier, overrideAlpha: overrideAlpha ? (
float?)iconAlpha :
null);
932 orderIndicatorCount[target] = orderIndicatorCount[target] + 1;
935 private static void DrawObjectiveIndicator(SpriteBatch spriteBatch, Camera cam, Character character,
Character.ObjectiveEntity objectiveEntity,
float iconAlpha = 1.0f)
937 if (objectiveEntity ==
null)
return;
939 Vector2 drawPos = objectiveEntity.Entity.WorldPosition;
940 GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, objectiveEntity.Sprite, objectiveEntity.Color * iconAlpha);
943 static partial
void RecreateHudTextsIfControllingProjSpecific(Character character)
951 static partial
void RecreateHudTextsIfFocusedProjSpecific(params Item[] items)
953 foreach (var item
in items)
955 if (item ==
Character.Controlled?.FocusedItem)
AfflictionPrefab is a prefab that defines a type of affliction that can be applied to a character....
static readonly Identifier ParalysisType
static readonly Identifier PoisonType
Vector2 WorldToScreen(Vector2 coords)
bool??????? ShowCampaignUI
static void ShowMissionProgressBar(Mission mission)
static void AddToGUIUpdateList(Character character)
static bool RecreateHudTexts
static LocalizedString GetCachedHudText(string textTag, InputType keyBind)
static bool MouseOnCharacterPortrait()
static bool IsCampaignInterfaceOpen
static void ShowBossHealthBar(Character character, float damage)
static void UpdateBossProgressBars(float deltaTime)
static void ClearBossProgressBars()
static void Draw(SpriteBatch spriteBatch, Character character, Camera cam)
static bool ShouldDrawInventory(Character character)
static void Update(float deltaTime, Character character, Camera cam)
static CharacterHealth?? OpenHealthWindow
CharacterHealth(Character character)
void AddToGUIUpdateList()
float GetAfflictionStrengthByType(Identifier afflictionType, bool allowLimbAfflictions=true)
void UpdateHUD(float deltaTime)
readonly CharacterParams Params
CharacterHealth CharacterHealth
Order GetCurrentOrderWithTopPriority()
CampaignMode.InteractionType CampaignInteractionType
bool ShowInteractionLabels
override Vector2? SimPosition
Item????????? SelectedItem
The primary selected item. It can be any device that character interacts with. This excludes items li...
static readonly List< Character > CharacterList
Character SelectedCharacter
bool CanBeHealedBy(Character character, bool checkFriendlyTeam=true)
CharacterInventory Inventory
override Vector2 DrawPosition
bool CanBeDraggedBy(Character character)
static Character? Controlled
LocalizedString CustomInteractHUDText
IEnumerable< ObjectiveEntity > ActiveObjectiveEntities
Character FocusedCharacter
bool IsInventoryAccessibleTo(Character character, CharacterInventory.AccessLevel accessLevel=CharacterInventory.AccessLevel.Limited)
Is the inventory accessible to the character? Doesn't check if the character can actually interact wi...
bool IsKnockedDown
Is the character knocked down regardless whether the technical state is dead, unconcious,...
override void Update(float deltaTime, Camera cam, bool isSubInventory=false)
Triggers a "conversation popup" with text and support for different branching options.
static bool FadeScreenToBlack
Responsible for keeping track of the characters in the player crew, saving and loading their orders,...
List< ActiveOrder > ActiveOrders
virtual Vector2 WorldPosition
virtual Vector2 DrawPosition
virtual Vector2 SimPosition
virtual void AddToGUIUpdateList(bool ignoreChildren=false, int order=0)
IEnumerable< GUIComponent > GetAllChildren()
Returns all child elements in the hierarchy.
void DrawToolTip(SpriteBatch spriteBatch)
Creates and draws a tooltip.
RectTransform RectTransform
Sprite GetDefaultSprite()
static GameSession?? GameSession
static SubEditorScreen SubEditorScreen
static NetworkMember NetworkMember
IEnumerable< Mission > Missions
void Draw(SpriteBatch spriteBatch, Camera cam)
static void UpdateDragging()
void ClearSubInventories()
static readonly List< Item > DraggingItems
virtual IEnumerable< Item > AllItems
All items contained in the inventory. Stacked items are returned as individual instances....
static bool DraggingItemToWorld
Item GetItemAt(int index)
Get the item stored in the specified inventory slot. If the slot contains a stack of items,...
override Vector2? SimPosition
List< ColoredText > GetHUDTexts(Character character, bool recreateHudTexts=true)
GUIComponentStyle IconStyle
Inventory ParentInventory
List< Repairable > Repairables
override Vector2? Position
void DrawHUD(SpriteBatch spriteBatch, Camera cam, Character character)
bool IsInteractable(Character character)
Returns interactibility based on whether the character is on a player team
static readonly List< Item > ItemList
List< ItemComponent > Components
static HashSet< Item > DeconstructItems
Items that have been marked for deconstruction
The base class for components holding the different functionalities of the item
virtual void AddToGUIUpdateList(int order=0)
virtual void DrawHUD(SpriteBatch spriteBatch, Character character)
readonly MissionPrefab Prefab
readonly int MaxProgressState
readonly LocalizedString ProgressBarLabel
readonly bool ShowProgressInNumbers
readonly Entity TargetEntity
bool DrawIconWhenContained
static readonly PrefabCollection< OrderPrefab > Prefabs
Submarine(SubmarineInfo info, bool showErrorMessages=true, Func< Submarine, List< MapEntity >> loadEntities=null, IdRemap linkedRemap=null)
static Body CheckVisibility(Vector2 rayStart, Vector2 rayEnd, bool ignoreLevel=false, bool ignoreSubs=false, bool ignoreSensors=true, bool ignoreDisabledWalls=true, bool ignoreBranches=true, Predicate< Fixture > blocksVisibilityPredicate=null)
Check visibility between two points (in sim units).
static IEnumerable< MapEntity > VisibleEntities
static readonly LanguageIdentifier None