Added hud buttons, fixed river generation, v1.2.0

This commit is contained in:
Nicola Sovic 2022-04-08 17:15:48 +02:00
parent 16568360a0
commit 8266248281
20 changed files with 1399 additions and 1540 deletions

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 873682bc55c49be4b9fca16d834d32dd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0ea8a2aba6d4cc14091b673cfa35521a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 147253693c1144643bb74750a4b1a88c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 18480a45caa3ef44baa79e8f13eac878 guid: 933686d7661c37c4b879eaf40fd0a016
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

BIN
Assets/IMG/MenuButton.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 42a12f98324a60845944b16ffaf6db0a guid: 893f84e302bddb74597e3eeaa23d5fbc
TextureImporter: TextureImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

View File

@ -0,0 +1,120 @@
fileFormatVersion: 2
guid: 55f0b3436398ebf47a855d859148d3ed
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 890 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

File diff suppressed because it is too large Load Diff

View File

@ -115,17 +115,12 @@ namespace Assets.Scripts
} }
public void closeIntroduction() public void closeIntroduction()
{
audioHandler.playButtonClick();
uihandler.openTutorial();
}
public void closeTutorial()
{ {
audioHandler.playButtonClick(); audioHandler.playButtonClick();
uihandler.startGame(); uihandler.startGame();
EventSystem.current.SetSelectedGameObject(null); EventSystem.current.SetSelectedGameObject(null);
} }
}
}
} }

View File

@ -2,6 +2,7 @@ using Assets.Scripts;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems;
public class Controls : MonoBehaviour public class Controls : MonoBehaviour
{ {
@ -25,6 +26,7 @@ public class Controls : MonoBehaviour
{ {
if (!player.GetComponent<Player>().takeDamage(0)) if (!player.GetComponent<Player>().takeDamage(0))
{ {
EventSystem.current.SetSelectedGameObject(null);
if (!uihandler.isPlayerInFight()) if (!uihandler.isPlayerInFight())
{ {
checkNormalControls(); checkNormalControls();

View File

@ -155,7 +155,43 @@ public class NoiseGenerator
private float[] calculateSamplesRiver(GameObject tile) private float[] calculateSamplesRiver(GameObject tile)
{ {
Mesh mesh = tile.GetComponent<MeshFilter>().mesh;
Vector3[] vertices = mesh.vertices;
float[] samples = calculateBasicSamples(tile); float[] samples = calculateBasicSamples(tile);
bool isVertical = (rand.Next(0,2) == 0 ? true : false);
int startX = 0;
int startZ = 0;
if (isVertical)
{
startZ = (rand.Next(0, 2) == 0 ? 4 : -4);
startX = rand.Next(-4, 5);
}
else
{
startZ = rand.Next(-4, 5);
startX = (rand.Next(0, 2) == 0 ? 4 : -4);
}
for (int k = 0; k < vertices.Length; k++)
{
if (isVertical)
{
if (Mathf.Round(vertices[k].x) == startX && Mathf.Round(vertices[k].z) != 5 && Mathf.Round(vertices[k].z) != -5)
{
samples[k] = samples[k] - rand.Next(2, 4) + 0.5f;
}
}
else
{
if (Mathf.Round(vertices[k].x) != 5 && Mathf.Round(vertices[k].x) != -5 && Mathf.Round(vertices[k].z) == startZ)
{
samples[k] = samples[k] - rand.Next(2, 4) + 0.5f;
}
}
}
Debug.Log("River"); Debug.Log("River");
return samples; return samples;
} }

View File

@ -25,6 +25,7 @@ namespace Assets.Scripts
public GameObject introduction; public GameObject introduction;
public GameObject tooltip; public GameObject tooltip;
public GameObject tutorial; public GameObject tutorial;
public GameObject buttonsHUD;
public UIState state; public UIState state;
@ -42,14 +43,6 @@ namespace Assets.Scripts
if (state == UIState.GAME) if (state == UIState.GAME)
{ {
updatePlayerHUD(); updatePlayerHUD();
Cursor.visible = false;
}
else
{
if (state != UIState.FIGHT && state != UIState.MAP && state != UIState.QUEST)
{
Cursor.visible = true;
}
} }
} }
@ -60,7 +53,7 @@ namespace Assets.Scripts
public bool canPlayerMove() public bool canPlayerMove()
{ {
if (state == UIState.GAME || state == UIState.MAP || state == UIState.CHARACTER || state == UIState.QUEST) if (state == UIState.GAME || state == UIState.CHARACTER || state == UIState.QUEST)
{ {
return true; return true;
} }
@ -74,6 +67,7 @@ namespace Assets.Scripts
public void startGame() public void startGame()
{ {
introduction.transform.localScale = new Vector3(0, 0, 0);
int index = GameObject.Find("dropSize").GetComponent<Dropdown>().value; int index = GameObject.Find("dropSize").GetComponent<Dropdown>().value;
int cityAmount = 0; int cityAmount = 0;
switch (index) switch (index)
@ -93,7 +87,6 @@ namespace Assets.Scripts
} }
GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().resetGame(cityAmount); GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().resetGame(cityAmount);
setPlayerInformation(); setPlayerInformation();
tutorial.transform.localScale = new Vector3(0,0,0);
compass.transform.localScale = new Vector3(1, 1, 1); compass.transform.localScale = new Vector3(1, 1, 1);
showHUD(); showHUD();
state = UIState.GAME; state = UIState.GAME;
@ -228,6 +221,7 @@ namespace Assets.Scripts
{ {
playerHUD.transform.localScale = new Vector3(1,1,1); playerHUD.transform.localScale = new Vector3(1,1,1);
compass.transform.localScale = new Vector3(1, 1, 1); compass.transform.localScale = new Vector3(1, 1, 1);
buttonsHUD.transform.localScale = new Vector3(1, 1, 1);
} }
public void openMainMenu() public void openMainMenu()
@ -238,7 +232,7 @@ namespace Assets.Scripts
public void switchPauseMenu() public void switchPauseMenu()
{ {
if (state == UIState.GAME || state == UIState.CHARACTER || state == UIState.MAP || state == UIState.PAUSE || state == UIState.QUEST) if (state == UIState.GAME || state == UIState.CHARACTER || state == UIState.PAUSE || state == UIState.QUEST)
{ {
if (state == UIState.PAUSE) if (state == UIState.PAUSE)
{ {
@ -546,11 +540,6 @@ namespace Assets.Scripts
state = UIState.TUTORIAL; state = UIState.TUTORIAL;
} }
public void openTutorial()
{
hideOtherElements(tutorial);
}
public void updateCreationInformation() public void updateCreationInformation()
{ {
setPlayerInformation(); setPlayerInformation();

View File

@ -12,7 +12,6 @@ namespace Assets.Scripts
FIGHT, FIGHT,
CHARACTERCREATION, CHARACTERCREATION,
CHARACTER, CHARACTER,
MAP,
DEATH, DEATH,
OPTIONS, OPTIONS,
GAME, GAME,