Cleaned up a bit of code, need to work on camera handlign (Isn't as smooth as I want it to be)

This commit is contained in:
Finnchen123
2025-06-07 09:23:38 +02:00
parent 5a68fc0447
commit aa7bb5ec79
14 changed files with 101 additions and 155 deletions

View File

@@ -1,3 +1,4 @@
using Assets.Scripts;
using Assets.Scripts.InteractableObjects;
using Newtonsoft.Json.Linq;
using System.Collections;
@@ -21,21 +22,21 @@ public class ContentGenerator : MonoBehaviour
return enemies[index];
}
public GameObject generateContent(string tiletype)
public GameObject generateContent(TileType tiletype)
{
switch (tiletype.ToLower())
switch (tiletype)
{
case "plain":
case TileType.PLAIN:
return generateTileContent();
case "mountains":
case TileType.MOUNTAINS:
return generateStoneTileContent();
case "forest":
case TileType.FOREST:
return generateTreeTileContent();
case "hills":
case TileType.HILLS:
return generateHillTileContent();
case "desert":
case TileType.DESERT:
return generateDesertTileContent();
case "city":
case TileType.CITY:
return generateCityTileContent();
}
return null;

View File

@@ -61,19 +61,9 @@ namespace Assets.Scripts.Player
// Update is called once per frame
void Update()
{
if (player == null)
{
return;
}
if (player.getStat("Killcount").getAmount() == -1)
{
return;
}
if (uihandler.state == UIState.DEATH)
{
return;
}
if (player == null) return;
if (player.getStat("Killcount").getAmount() == -1) return;
if (uihandler.state == UIState.DEATH) return;
getRotation();
regeneratePlayer();

View File

@@ -35,23 +35,25 @@ namespace Assets.Scripts.Player
private void generateStats(bool isLoad)
{
stats = new Dictionary<string, PlayerStat>();
stats.Add("Health", new PlayerStat("Health", 100, "The current health of the player"));
stats.Add("MaxHealth", new PlayerStat("MaxHealth", 100, "The current max health of the player"));
stats.Add("Secondary", new PlayerStat("Secondary", 20, "The current secondary of the player"));
stats.Add("MaxSecondary", new PlayerStat("MaxSecondary", 20, "The current max secondary of the player"));
stats.Add("Strength", new PlayerStat("Strength", 5, "The current strength of the player"));
stats.Add("Dexterity", new PlayerStat("Dexterity", 5, "The current dexterity of the player"));
stats.Add("Intelligence", new PlayerStat("Intelligence", 5, "The current intelligence of the player"));
stats.Add("Experience", new PlayerStat("Experience", 0, "The current experience of the player"));
stats.Add("MaxExperience", new PlayerStat("MaxExperience", 10, "The current max experience of the player"));
stats.Add("SecondaryRegen", new PlayerStat("SecondaryRegen", 5, "The current secondary regen of the player"));
stats.Add("Level", new PlayerStat("Level", 0, "The current level of the player"));
stats.Add("Luck", new PlayerStat("Luck", 20 - (difficulty * 5), "The current luck of the player"));
stats.Add("Killcount", new PlayerStat("Killcount", -1, "The current killcount of the player"));
stats.Add("Points", new PlayerStat("Points", 0, "The current skillpoints of the player"));
stats.Add("TreeCount", new PlayerStat("TreeCount",0,"The amount of trees the player chopped"));
stats.Add("OreCount", new PlayerStat("OreCount",0,"The amount of ores the player mined"));
stats = new Dictionary<string, PlayerStat>
{
{ "Health", new PlayerStat("Health", 100, "The current health of the player") },
{ "MaxHealth", new PlayerStat("MaxHealth", 100, "The current max health of the player") },
{ "Secondary", new PlayerStat("Secondary", 20, "The current secondary of the player") },
{ "MaxSecondary", new PlayerStat("MaxSecondary", 20, "The current max secondary of the player") },
{ "Strength", new PlayerStat("Strength", 5, "The current strength of the player") },
{ "Dexterity", new PlayerStat("Dexterity", 5, "The current dexterity of the player") },
{ "Intelligence", new PlayerStat("Intelligence", 5, "The current intelligence of the player") },
{ "Experience", new PlayerStat("Experience", 0, "The current experience of the player") },
{ "MaxExperience", new PlayerStat("MaxExperience", 10, "The current max experience of the player") },
{ "SecondaryRegen", new PlayerStat("SecondaryRegen", 5, "The current secondary regen of the player") },
{ "Level", new PlayerStat("Level", 0, "The current level of the player") },
{ "Luck", new PlayerStat("Luck", 20 - (difficulty * 5), "The current luck of the player") },
{ "Killcount", new PlayerStat("Killcount", -1, "The current killcount of the player") },
{ "Points", new PlayerStat("Points", 0, "The current skillpoints of the player") },
{ "TreeCount", new PlayerStat("TreeCount", 0, "The amount of trees the player chopped") },
{ "OreCount", new PlayerStat("OreCount", 0, "The amount of ores the player mined") }
};
if (!isLoad)
{

View File

@@ -25,19 +25,19 @@ namespace Assets.Scripts.Player
}
public string getTooltip(){
return this.tooltip;
return tooltip;
}
public string getText(){
return this.text;
return text;
}
public int getAmount(){
return this.amount;
return amount;
}
public void changeAmount(int change){
this.amount = this.amount + change;
amount += change;
}
public void setAmount(int amount){

View File

@@ -77,7 +77,7 @@ public class Tile : MonoBehaviour
if (chance >= 25)
{
GameObject content = contentGenerator.GetComponent<ContentGenerator>().generateContent(tiletype.ToString());
GameObject content = contentGenerator.GetComponent<ContentGenerator>().generateContent(tiletype);
if (content != null)
{
GameObject obj = Instantiate(content, position, Quaternion.identity, gameObject.transform);