fixed HUD buttons, added eastereggs, fixed object spawn, added coordinates, enabled new tutorial, v1.2.0

This commit is contained in:
Nicola Sovic
2022-04-12 14:18:37 +02:00
parent cb7541ce85
commit 0ce547fb74
10 changed files with 382 additions and 27 deletions

View File

@@ -138,7 +138,5 @@ namespace Assets.Scripts
audioHandler.playButtonClick();
uihandler.switchPauseMenu();
}
}
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Assets.Scripts
{
@@ -10,7 +11,10 @@ namespace Assets.Scripts
{
public static void applyEasterEgg(Player player)
{
applyNameEasterEgg(player);
if (player.getPlayerName().ToLower().Length > 0)
{
applyNameEasterEgg(player);
}
}
private static void applyNameEasterEgg(Player player)
@@ -40,8 +44,27 @@ namespace Assets.Scripts
result[3] = 47;
result[4] = 47;
break;
default:
//health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence, level, experience, maxExperience, points
int[] stats = player.getStats();
result[0] = stats[1];
result[1] = stats[3];
result[2] = stats[4];
result[3] = stats[5];
result[4] = stats[6];
break;
}
player.setStats(result);
}
public static bool isGodMode(Player player)
{
bool result = false;
if (player.getPlayerName().ToLower() == "nicola")
{
result = true;
}
return result;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b2fc753c5a9822f42a6cb9451e7ac30a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -118,14 +118,12 @@ public class NoiseGenerator
private float[] calculateSamplesPlane(GameObject tile)
{
float[] samples = calculateBasicSamples(tile);
Debug.Log("Plane");
return samples;
}
private float[] calculateSamplesForest(GameObject tile)
{
float[] samples = calculateBasicSamples(tile);
Debug.Log("Forest");
return samples;
}
@@ -149,7 +147,6 @@ public class NoiseGenerator
}
} while (true);
}
Debug.Log("Mountain");
return samples;
}
@@ -192,7 +189,6 @@ public class NoiseGenerator
}
}
Debug.Log("River");
return samples;
}
@@ -219,7 +215,6 @@ public class NoiseGenerator
}
}
}
Debug.Log("Lake");
return samples;
}

View File

@@ -67,6 +67,7 @@ namespace Assets.Scripts
this.role.applyBonus(this);
this.difficulty = difficulty;
generateSkills();
EasterEggHandler.applyEasterEgg(this);
}
private void generateSkills()
@@ -253,7 +254,9 @@ namespace Assets.Scripts
public void setStats(int[] stats)
{
maxHealth = stats[0];
health = maxHealth;
maxSecondary = stats[1];
secondary = maxSecondary;
strength = stats[2];
dexterity = stats[3];
intelligence = stats[4];
@@ -354,16 +357,19 @@ namespace Assets.Scripts
{
if (amount > 0)
{
if (isDodging)
if (!EasterEggHandler.isGodMode(this))
{
isDodging = false;
}
else
{
if (rand.Next(1, 101) > dexterity + (intelligence / 2))
if (isDodging)
{
health = health - amount;
audioHandler.playDamage();
isDodging = false;
}
else
{
if (rand.Next(1, 101) > dexterity + (intelligence / 2))
{
health = health - amount;
audioHandler.playDamage();
}
}
}
}

View File

@@ -209,4 +209,9 @@ public class Tile : MonoBehaviour
enemy.GetComponent<Collider>().enabled = false;
aliveEnemies.Remove(enemy);
}
public string getTileType()
{
return tiletype;
}
}

View File

@@ -45,9 +45,26 @@ namespace Assets.Scripts
{
updatePlayerHUD();
switchWaterLayer();
updateCoordinates();
}
}
private void updateCoordinates()
{
GameObject coordinates = GameObject.Find("txtCoordinates");
Vector3 position = GameObject.Find("Player").transform.position;
string tiletype = GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().getCurrentTile().GetComponent<Tile>().getTileType();
if (tiletype != null)
{
tiletype = tiletype.Replace("Tile", "");
}
else
{
tiletype = "Spawn";
}
coordinates.GetComponent<Text>().text = tiletype + "(" + (int)position.x + "/" + (int)position.y + "/" + (int)position.z + ")";
}
private void switchWaterLayer()
{
if (GameObject.Find("Player").transform.position.y < -1)
@@ -101,7 +118,7 @@ namespace Assets.Scripts
}
GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>().resetGame(cityAmount);
setPlayerInformation();
compass.transform.localScale = new Vector3(1, 1, 1);
tutorial.transform.localScale = new Vector3(1, 1, 1);
showHUD();
state = UIState.GAME;
EventSystem.current.SetSelectedGameObject(null);
@@ -572,5 +589,10 @@ namespace Assets.Scripts
GameObject.Find("txtSecondary_Creation").GetComponent<Text>().text = "Mana: " + playerstats[3];
}
public void closeTutorial()
{
tutorial.transform.localScale = new Vector3(0,0,0);
}
}
}