Add text to hud

This commit is contained in:
Sofia 2019-08-04 21:23:39 +03:00
parent 2435a0e136
commit 1ab8358b92
2 changed files with 174 additions and 0 deletions

View File

@ -179,6 +179,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 4531584877236580830} - {fileID: 4531584877236580830}
- {fileID: 7284224560410978584}
m_Father: {fileID: 4910715999455506354} m_Father: {fileID: 4910715999455506354}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -457,6 +458,8 @@ MonoBehaviour:
FunMeter: {fileID: 7812496038623515921} FunMeter: {fileID: 7812496038623515921}
DamageTextGore: {fileID: 4391485460155157709} DamageTextGore: {fileID: 4391485460155157709}
DamageTextFun: {fileID: 2245787847809376028} DamageTextFun: {fileID: 2245787847809376028}
FunTextGore: {fileID: 7640436017276778357}
FunTextFun: {fileID: 3835519758412193648}
--- !u!114 &3806237922719029712 --- !u!114 &3806237922719029712
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -471,6 +474,164 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
GoreObject: {fileID: 8440319295527082093} GoreObject: {fileID: 8440319295527082093}
CensoredObject: {fileID: 1536973168977449449} CensoredObject: {fileID: 1536973168977449449}
--- !u!1 &3453228596608320022
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2839059162232042292}
- component: {fileID: 5773967910327396056}
- component: {fileID: 7640436017276778357}
m_Layer: 5
m_Name: FunText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2839059162232042292
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3453228596608320022}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 7485172030629334178}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -746.6, y: -24.2}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5773967910327396056
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3453228596608320022}
m_CullTransparentMesh: 0
--- !u!114 &7640436017276778357
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3453228596608320022}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: f3ca06d8c094ade4180b1ebe0cecdf54, type: 3}
m_FontSize: 25
m_FontStyle: 0
m_BestFit: 1
m_MinSize: 0
m_MaxSize: 50
m_Alignment: 0
m_AlignByGeometry: 1
m_RichText: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: Extremely fun
--- !u!1 &4761757777296760444
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7284224560410978584}
- component: {fileID: 21748230045983853}
- component: {fileID: 3835519758412193648}
m_Layer: 5
m_Name: FunText
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7284224560410978584
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4761757777296760444}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 3965881083143910201}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: -746.6, y: -24.200012}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &21748230045983853
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4761757777296760444}
m_CullTransparentMesh: 0
--- !u!114 &3835519758412193648
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4761757777296760444}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: c2b8548a6d222b44cbdceae5b971a677, type: 3}
m_FontSize: 25
m_FontStyle: 0
m_BestFit: 1
m_MinSize: 0
m_MaxSize: 50
m_Alignment: 0
m_AlignByGeometry: 1
m_RichText: 0
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: Extremely fun
--- !u!1 &5159878213919589737 --- !u!1 &5159878213919589737
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -576,6 +737,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 594860309237950776} - {fileID: 594860309237950776}
- {fileID: 2839059162232042292}
m_Father: {fileID: 4910715999455506354} m_Father: {fileID: 4910715999455506354}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -12,6 +12,12 @@ namespace Saltosion.OneWeapon {
public Text DamageTextGore; public Text DamageTextGore;
public Text DamageTextFun; public Text DamageTextFun;
public Text FunTextGore;
public Text FunTextFun;
private string[] GoreTexts = new string[] { "I'm gonna die of boredom!", "Ultra lame!", "Oof, boring!", "That's cool!", "Holy fuck!", "Bloody awesome!" };
private string[] FunTexts = new string[] { "I'm gonna fall asleep!", "You should try doing something!", "There aren't enough flowers", "Now that's pretty!", "You're doing great!", "Faboulous!" };
void Start() { void Start() {
} }
@ -42,10 +48,16 @@ namespace Saltosion.OneWeapon {
GoreColor.g = 1 - PlayerFun.CurrentDamageBoost; GoreColor.g = 1 - PlayerFun.CurrentDamageBoost;
GoreColor.b = 1 - PlayerFun.CurrentDamageBoost; GoreColor.b = 1 - PlayerFun.CurrentDamageBoost;
DamageTextGore.color = GoreColor; DamageTextGore.color = GoreColor;
FunTextGore.color = GoreColor;
Color FunColor = DamageTextFun.color; Color FunColor = DamageTextFun.color;
FunColor.b = 1 - PlayerFun.CurrentDamageBoost; FunColor.b = 1 - PlayerFun.CurrentDamageBoost;
DamageTextFun.color = FunColor; DamageTextFun.color = FunColor;
FunTextFun.color = FunColor;
int FunLevelInt = (int)Mathf.Min(Mathf.Floor(FunPercent * 6), 5);
FunTextGore.text = GoreTexts[FunLevelInt];
FunTextFun.text = FunTexts[FunLevelInt];
} }
} }