UI and mechanics update, v1.1.0

This commit is contained in:
Nicola Sovic 2022-03-10 18:34:15 +01:00
parent 9c92d59b17
commit 8f15cbdeb7
7 changed files with 130 additions and 26 deletions

View File

@ -942,7 +942,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: A game created by Nicola Sovic m_Text: A game created by Finnchen
--- !u!222 &53438960 --- !u!222 &53438960
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5999,7 +5999,8 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children:
- {fileID: 1300518927}
m_Father: {fileID: 1661015974} m_Father: {fileID: 1661015974}
m_RootOrder: 12 m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -9690,7 +9691,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: 'Secondary: 100' m_Text: 'Mana: 100'
--- !u!222 &662300492 --- !u!222 &662300492
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -18779,7 +18780,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0 m_HorizontalOverflow: 0
m_VerticalOverflow: 0 m_VerticalOverflow: 0
m_LineSpacing: 1 m_LineSpacing: 1
m_Text: Your max secondary m_Text: Your max Mana
--- !u!222 &1202590057 --- !u!222 &1202590057
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -20113,6 +20114,81 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1294134568} m_GameObject: {fileID: 1294134568}
m_CullTransparentMesh: 1 m_CullTransparentMesh: 1
--- !u!1 &1300518926
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1300518927}
- component: {fileID: 1300518929}
- component: {fileID: 1300518928}
m_Layer: 5
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1300518927
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1300518926}
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: 413620642}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: -40, y: -20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1300518928
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1300518926}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1300518929
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1300518926}
m_CullTransparentMesh: 1
--- !u!1 &1331120486 --- !u!1 &1331120486
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -25026,7 +25102,7 @@ MonoBehaviour:
I welcome you to Novariel, a vast world filled I welcome you to Novariel, a vast world filled
with beautiful scenerie... with beautiful scenery...
... and slimes. ... and slimes.
@ -25050,7 +25126,7 @@ MonoBehaviour:
I hope you enjoy your time I hope you enjoy your time
Nicola' Finnchen'
--- !u!222 &1703871791 --- !u!222 &1703871791
CanvasRenderer: CanvasRenderer:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -62,18 +62,18 @@ namespace Assets.Scripts
image.GetComponent<RawImage>().texture = skillIcon; image.GetComponent<RawImage>().texture = skillIcon;
if (canPlayerCast(playerSecondary)) if (canPlayerCast(playerSecondary))
{ {
desc.GetComponent<Text>().text = skillname + "(Lvl." + level + ") (" + secondaryConsumption + ")"; desc.GetComponent<Text>().text = skillname + "(" + secondaryConsumption + ")";
} }
else else
{ {
desc.GetComponent<Text>().text = "Not castable (" + secondaryConsumption + ")"; desc.GetComponent<Text>().text = "(" + secondaryConsumption + " mana) " + "("+cooldown+" cd)";
} }
} }
public void displaySkill(GameObject image, GameObject desc) public void displaySkill(GameObject image, GameObject desc)
{ {
image.GetComponent<RawImage>().texture = skillIcon; image.GetComponent<RawImage>().texture = skillIcon;
desc.GetComponent<Text>().text = skillname + "(Lvl." + level + "): \r\n" + description; desc.GetComponent<Text>().text = skillname + "(Mana: " + secondaryConsumption + "): \r\n" + description;
} }
public void reduceCooldown() public void reduceCooldown()

View File

@ -111,6 +111,7 @@ namespace Assets.Scripts
audioHandler.playButtonClick(); audioHandler.playButtonClick();
uihandler.adaptScreen(); uihandler.adaptScreen();
audioHandler.saveAudioSettings(); audioHandler.saveAudioSettings();
uihandler.closeOptions();
} }
public void closeTutorial() public void closeTutorial()

View File

@ -35,6 +35,7 @@ namespace Assets.Scripts
BasicSkill[] skills = new BasicSkill[3]; BasicSkill[] skills = new BasicSkill[3];
int points = 0; int points = 0;
bool isDodging = false; bool isDodging = false;
DateTime jumpTimer;
int killcount = -1; int killcount = -1;
int difficulty = 0; int difficulty = 0;
@ -73,27 +74,27 @@ namespace Assets.Scripts
switch (role.classname) switch (role.classname)
{ {
case "Warrior": case "Warrior":
skills[0] = new BasicSkill(15,10,2,"Slash","Skills/Warrior/Slash",null); skills[0] = new BasicSkill(20,10,2,"Slash","Skills/Warrior/Slash",null);
skills[0].setDescription("A basic slash. But better than a basic attack"); skills[0].setDescription("A basic slash. But better than a basic attack");
skills[1] = new BasicSkill(0, 5, 1, "Block", "Skills/Warrior/Block", null); skills[1] = new BasicSkill(0, 5, 1, "Block", "Skills/Warrior/Block", null);
skills[1].setDescription("Block the next attack"); skills[1].setDescription("Block the next attack");
skills[2] = new BasicSkill(30, 30, 4, "Execution", "Skills/Warrior/Execution", null); skills[2] = new BasicSkill(35, 30, 4, "Execution", "Skills/Warrior/Execution", null);
skills[2].setDescription("A powerful skill. But hard to cast early"); skills[2].setDescription("A powerful skill. But hard to cast early");
break; break;
case "Thief": case "Thief":
skills[0] = new BasicSkill(15, 10, 2, "Stab", "Skills/Thief/Stab", null); skills[0] = new BasicSkill(20, 10, 2, "Stab", "Skills/Thief/Stab", null);
skills[0].setDescription("Early skill to apply some damage."); skills[0].setDescription("Early skill to apply some damage.");
skills[1] = new BasicSkill(0, 5, 1, "SmokeScreen", "Skills/Thief/SmokeScreen", null); skills[1] = new BasicSkill(0, 5, 1, "SmokeScreen", "Skills/Thief/SmokeScreen", null);
skills[1].setDescription("Hide from the next attack"); skills[1].setDescription("Hide from the next attack");
skills[2] = new BasicSkill(30, 30, 4, "Heartstop", "Skills/Thief/Heartstop", null); skills[2] = new BasicSkill(35, 30, 4, "Heartstop", "Skills/Thief/Heartstop", null);
skills[2].setDescription("Stop the heart of your enemy. High damage."); skills[2].setDescription("Stop the heart of your enemy. High damage.");
break; break;
case "Mage": case "Mage":
skills[0] = new BasicSkill(15, 10, 2, "Icicle", "Skills/Mage/Icicle", null); skills[0] = new BasicSkill(20, 10, 2, "Icicle", "Skills/Mage/Icicle", null);
skills[0].setDescription("Small icicles to cut down your enemies HP"); skills[0].setDescription("Small icicles to cut down your enemies HP");
skills[1] = new BasicSkill(0, 5, 1, "Teleport", "Skills/Mage/Teleport", null); skills[1] = new BasicSkill(0, 5, 1, "Teleport", "Skills/Mage/Teleport", null);
skills[1].setDescription("Evade the next attack"); skills[1].setDescription("Evade the next attack");
skills[2] = new BasicSkill(30, 30, 4, "Fireball", "Skills/Mage/Fireball", null); skills[2] = new BasicSkill(35, 30, 4, "Fireball", "Skills/Mage/Fireball", null);
skills[2].setDescription("What a big fireball. Does some good damage"); skills[2].setDescription("What a big fireball. Does some good damage");
break; break;
} }
@ -156,7 +157,7 @@ namespace Assets.Scripts
private void healPlayer() private void healPlayer()
{ {
health = health + 5; health = health + 30 / (difficulty + 1);
if (health >= maxHealth) if (health >= maxHealth)
{ {
health = maxHealth; health = maxHealth;
@ -170,8 +171,18 @@ namespace Assets.Scripts
if (Input.GetKeyDown(KeyCode.Space)) if (Input.GetKeyDown(KeyCode.Space))
{ {
if ((int)(gameObject.GetComponent<Rigidbody>().velocity.y * 10) == 0) if (jumpTimer != null)
{ {
if (jumpTimer.AddSeconds(1).CompareTo(DateTime.Now) <= 0)
{
jumpTimer = DateTime.Now;
gameObject.GetComponent<Rigidbody>().velocity = new Vector3(0, 5, 0);
audioHandler.playJump();
}
}
else
{
jumpTimer = DateTime.Now;
gameObject.GetComponent<Rigidbody>().velocity = new Vector3(0, 5, 0); gameObject.GetComponent<Rigidbody>().velocity = new Vector3(0, 5, 0);
audioHandler.playJump(); audioHandler.playJump();
} }
@ -350,7 +361,7 @@ namespace Assets.Scripts
{ {
uihandler.showMessage("SUCCESS;You killed your enemy!"); uihandler.showMessage("SUCCESS;You killed your enemy!");
killcount++; killcount++;
if (killcount == 30 * (difficulty + 1) && GameObject.Find("Worldgenerator").GetComponent<WorldGenerator>().gameWon()) if (killcount >= 30 * (difficulty + 1) && GameObject.Find("Worldgenerator").GetComponent<WorldGenerator>().gameWon())
{ {
uihandler.showMessage("SUCCESS;You won the game!"); uihandler.showMessage("SUCCESS;You won the game!");
} }

View File

@ -29,7 +29,7 @@ namespace Assets.Scripts.Slimes
strength = playerStats[4]; strength = playerStats[4];
dexterity = playerStats[5]; dexterity = playerStats[5];
intelligence = playerStats[6]; intelligence = playerStats[6];
experience = (int)(10 + playerStats[7] * 1.5f); experience = (int)(10 + playerStats[7] * 2.5f);
level = playerStats[7]; level = playerStats[7];
} }

View File

@ -192,7 +192,6 @@ namespace Assets.Scripts
state = UIState.PAUSEOPTIONS; state = UIState.PAUSEOPTIONS;
} }
GameObject.Find("ScrollbarOptions").GetComponent<Scrollbar>().value = 1f; GameObject.Find("ScrollbarOptions").GetComponent<Scrollbar>().value = 1f;
} }
public void closeOptions() public void closeOptions()
@ -272,9 +271,18 @@ namespace Assets.Scripts
closePauseMenu(); closePauseMenu();
} }
else else
{
if (state == UIState.GAME)
{ {
openPauseMenu(); openPauseMenu();
} }
else
{
hideOtherElements(null);
showHUD();
state = UIState.GAME;
}
}
} }
} }
@ -374,8 +382,11 @@ namespace Assets.Scripts
GameObject.Find("Canvas").transform.GetChild(i).localScale = new Vector3(0, 0, 0); GameObject.Find("Canvas").transform.GetChild(i).localScale = new Vector3(0, 0, 0);
} }
} }
if (obj != null)
{
obj.transform.localScale = new Vector3(1, 1, 1); obj.transform.localScale = new Vector3(1, 1, 1);
} }
}
public void displayInformation(string information) public void displayInformation(string information)
{ {
@ -453,7 +464,7 @@ namespace Assets.Scripts
GameObject.Find("txtDexterity").GetComponent<Text>().text = "DEX: " + playerStats[5]; GameObject.Find("txtDexterity").GetComponent<Text>().text = "DEX: " + playerStats[5];
GameObject.Find("txtIntelligence").GetComponent<Text>().text = "INT: " + playerStats[6]; GameObject.Find("txtIntelligence").GetComponent<Text>().text = "INT: " + playerStats[6];
GameObject.Find("txtHealth").GetComponent<Text>().text = "Health: " + playerStats[1]; GameObject.Find("txtHealth").GetComponent<Text>().text = "Health: " + playerStats[1];
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Secondary: " + playerStats[3]; GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + playerStats[3];
updateHealthUI(playerStats[0], playerStats[1]); updateHealthUI(playerStats[0], playerStats[1]);
updateSecondaryUI(playerStats[2], playerStats[3]); updateSecondaryUI(playerStats[2], playerStats[3]);
@ -540,7 +551,12 @@ namespace Assets.Scripts
public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue) public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue)
{ {
string text = minValue + "/" + maxValue; string text = minValue + "/" + maxValue;
double percentage = (1 / (double)maxValue) * minValue; double percentage = 0;
if (maxValue > 0)
{
percentage = (1 / (double)maxValue) * minValue;
}
float change = (float)(barBackground.GetComponent<RectTransform>().rect.width - (barBackground.GetComponent<RectTransform>().rect.width * percentage)); float change = (float)(barBackground.GetComponent<RectTransform>().rect.width - (barBackground.GetComponent<RectTransform>().rect.width * percentage));
if (textField != null) if (textField != null)

View File

@ -1,2 +1,2 @@
Music:0.07957498 Music:0
Effects:1 Effects:0