fixed chest, improved ui, improved difficulty
This commit is contained in:
@@ -28,7 +28,7 @@ namespace Assets.Scripts
|
||||
}
|
||||
else
|
||||
{
|
||||
gameObject.transform.parent.Find("Lid").GetComponent<Animator>().Play("ChestOpen");
|
||||
gameObject.transform.Find("Lid").GetComponent<Animator>().Play("ChestOpen");
|
||||
Item item;
|
||||
int luck = GameObject.Find("Player").GetComponent<PlayerGameObject>().getPlayerStat("Luck").getAmount();
|
||||
int type = new System.Random().Next(3);
|
||||
@@ -57,7 +57,7 @@ namespace Assets.Scripts
|
||||
public void loadChest(bool gotItem){
|
||||
this.gotItem = gotItem;
|
||||
if(gotItem){
|
||||
gameObject.transform.parent.Find("Lid").GetComponent<Animator>().Play("ChestOpen");
|
||||
gameObject.transform.Find("Lid").GetComponent<Animator>().Play("ChestOpen");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,15 +260,15 @@ public class ContentGenerator : MonoBehaviour
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (chance >= 10 && chance < 40)
|
||||
else if (chance >= 10 && chance < 25)
|
||||
{
|
||||
return house;
|
||||
}
|
||||
else if (chance >= 40 && chance < 65)
|
||||
else if (chance >= 25 && chance < 55)
|
||||
{
|
||||
return trees[rand.Next(0, trees.Length)];
|
||||
}
|
||||
else if (chance >= 65 && chance < 90)
|
||||
else if (chance >= 55 && chance < 85)
|
||||
{
|
||||
return stones[rand.Next(0, stones.Length)];
|
||||
}
|
||||
|
||||
@@ -69,21 +69,15 @@ public class Controls : MonoBehaviour
|
||||
if (uihandler.canPlayerRotate()){
|
||||
playerCam.GetComponent<PlayerCamera>().lookAround(view, playerInput.currentControlScheme == "Controller");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FixedUpdate(){
|
||||
if (!player.GetComponent<PlayerGameObject>().takeDamage(0))
|
||||
{
|
||||
if (!uihandler.isPlayerInFight())
|
||||
{
|
||||
if (uihandler.canPlayerMove())
|
||||
{
|
||||
player.GetComponent<PlayerGameObject>().move(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FixedUpdate(){
|
||||
if(direction != MoveDirection.None){
|
||||
AxisEventData data = new AxisEventData(EventSystem.current);
|
||||
data.moveDir = direction;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Fight : MonoBehaviour
|
||||
this.enemy = enemy;
|
||||
this.player = player;
|
||||
enemy.GetComponent<Enemy>().scaleEnemy(player.GetComponent<PlayerGameObject>());
|
||||
enemy.transform.rotation = Quaternion.Euler(0,GameObject.Find("Main Camera").transform.rotation.y + 180f,0);
|
||||
enemy.transform.rotation = Quaternion.Euler(0, GameObject.Find("Main Camera").transform.rotation.y + 180f, 0);
|
||||
|
||||
uihandler = GameObject.Find("UIHandler").GetComponent<UIHandler>();
|
||||
uihandler.openFight();
|
||||
@@ -37,11 +37,20 @@ public class Fight : MonoBehaviour
|
||||
{
|
||||
int playerDamage = 0;
|
||||
int skillnumber = -1;
|
||||
bool escapedSuccesfully = false;
|
||||
switch (index)
|
||||
{
|
||||
case 1:
|
||||
endFight();
|
||||
uihandler.showMessage("INFORMATION;"+TextHandler.getText("escape"));
|
||||
if (rand.Next(1, 11) <= 3)
|
||||
{
|
||||
escapedSuccesfully = true;
|
||||
endFight();
|
||||
uihandler.showMessage("INFORMATION;" + TextHandler.getText("escape"));
|
||||
}
|
||||
else
|
||||
{
|
||||
uihandler.showMessage("ERROR;" + TextHandler.getText("escapeFail"));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
//User waits
|
||||
@@ -81,7 +90,8 @@ public class Fight : MonoBehaviour
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index != 1)
|
||||
int chance = escapedSuccesfully ? 3 : 10;
|
||||
if (rand.Next(1, 11) <= chance)
|
||||
{
|
||||
enemyAction();
|
||||
uihandler.updateFightInterface(enemy, player);
|
||||
@@ -94,7 +104,7 @@ public class Fight : MonoBehaviour
|
||||
int enemyDamage = -1;
|
||||
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence };
|
||||
int[] enemyStats = enemy.GetComponent<Enemy>().getStats();
|
||||
int index = rand.Next(0,2);
|
||||
int index = rand.Next(0, 2);
|
||||
|
||||
if (index == 1 && enemyStats[2] <= 0)
|
||||
{
|
||||
|
||||
@@ -11,61 +11,29 @@ namespace Assets.Scripts
|
||||
{
|
||||
class EasterEggHandler
|
||||
{
|
||||
public static void applyEasterEgg(PlayerObject player)
|
||||
public static void applyEasterEgg(string playername)
|
||||
{
|
||||
if (player.getPlayerName().ToLower().Length > 0)
|
||||
if (playername.ToLower().Length > 0)
|
||||
{
|
||||
applyNameEasterEgg(player);
|
||||
applyNameEasterEgg(playername.ToLower());
|
||||
}
|
||||
}
|
||||
|
||||
private static void applyNameEasterEgg(PlayerObject player)
|
||||
private static void applyNameEasterEgg(string playername)
|
||||
{
|
||||
//maxHealth, maxSecondary, strength, dexterity, intelligence
|
||||
/*int[] result = new int[5];
|
||||
int[] stats = player.getStats();
|
||||
switch (player.getPlayerName().ToLower())
|
||||
//TODO: Create achievements fitting of their contribution... no game changing things, except godmode
|
||||
switch (playername)
|
||||
{
|
||||
case "threetimes8":
|
||||
result[0] = 240;
|
||||
result[1] = 240;
|
||||
result[2] = 24;
|
||||
result[3] = 24;
|
||||
result[4] = 24;
|
||||
break;
|
||||
case "finnchen123":
|
||||
result[0] = 1230;
|
||||
result[1] = 1230;
|
||||
result[2] = 123;
|
||||
result[3] = 123;
|
||||
result[4] = 123;
|
||||
break;
|
||||
case "thefluffeypanda":
|
||||
result[0] = 470;
|
||||
result[1] = 470;
|
||||
result[2] = 47;
|
||||
result[3] = 47;
|
||||
result[4] = 47;
|
||||
break;
|
||||
case "nicola":
|
||||
result[0] = stats[1];
|
||||
result[1] = stats[3];
|
||||
result[2] = stats[4];
|
||||
result[3] = stats[5];
|
||||
result[4] = stats[6];
|
||||
SteamWorksHandler.getGodModeAchievement();
|
||||
break;
|
||||
default:
|
||||
result[0] = stats[1];
|
||||
result[1] = stats[3];
|
||||
result[2] = stats[4];
|
||||
result[3] = stats[5];
|
||||
result[4] = stats[6];
|
||||
break;
|
||||
}
|
||||
player.setStats(result);*/
|
||||
|
||||
//TODO FIX whole Easteregg mechanic to go with the new player
|
||||
}
|
||||
|
||||
public static bool isGodMode(PlayerObject player)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Assets.Scripts
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (state == UIState.GAME)
|
||||
if (state == UIState.GAME || state == UIState.FIGHT)
|
||||
{
|
||||
if (GameObject.Find("Player").GetComponent<PlayerGameObject>().getPlayerStat("Killcount").getAmount() == -1)
|
||||
{
|
||||
@@ -161,6 +161,7 @@ namespace Assets.Scripts
|
||||
{
|
||||
GameObject.Find("txtRounds").GetComponent<Text>().text = "-1";
|
||||
hideOtherElements(fight);
|
||||
playerHUD.transform.localScale = new Vector3(1, 1, 1);
|
||||
state = UIState.FIGHT;
|
||||
}
|
||||
|
||||
@@ -352,7 +353,6 @@ namespace Assets.Scripts
|
||||
|
||||
public void updateFightInterface(GameObject enemy, GameObject player)
|
||||
{
|
||||
updateFightInterfacePlayer(player.GetComponent<PlayerGameObject>());
|
||||
updateFightInterfaceEnemy(enemy);
|
||||
updateFightInterfaceActions(player.GetComponent<PlayerGameObject>());
|
||||
GameObject.Find("txtRounds").GetComponent<Text>().text = (int.Parse(GameObject.Find("txtRounds").GetComponent<Text>().text) + 1).ToString();
|
||||
@@ -369,21 +369,6 @@ namespace Assets.Scripts
|
||||
player.displayAction(2, actionSix.transform.Find("imgAction").gameObject, actionSix.transform.Find("descAction").gameObject);
|
||||
}
|
||||
|
||||
private void updateFightInterfacePlayer(PlayerGameObject player)
|
||||
{
|
||||
Dictionary<string, int> equipment = inventory.GetComponent<Inventory>().getEquipmentBonus();
|
||||
|
||||
GameObject foreground = GameObject.Find("healthForegroundPlayer");
|
||||
GameObject background = GameObject.Find("healthBackgroundPlayer");
|
||||
GameObject text = GameObject.Find("healthTextPlayer");
|
||||
updateBar(foreground, background, text, player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"], player.getPlayerStat("Health").getAmount());
|
||||
|
||||
foreground = GameObject.Find("secondaryForegroundPlayer");
|
||||
background = GameObject.Find("secondaryBackgroundPlayer");
|
||||
text = GameObject.Find("secondaryTextPlayer");
|
||||
updateBar(foreground, background, text, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
|
||||
}
|
||||
|
||||
private void updateFightInterfaceEnemy(GameObject enemy)
|
||||
{
|
||||
// { health, maxHealth, secondary, maxSecondary, strength, dexterity, intelligence };
|
||||
@@ -407,8 +392,8 @@ namespace Assets.Scripts
|
||||
GameObject.Find("txtStrength").GetComponent<Text>().text = "STR: " + player.getPlayerStat("Strength").getAmount() + " (+" + equipment["STR"] + ")";
|
||||
GameObject.Find("txtDexterity").GetComponent<Text>().text = "DEX: " + player.getPlayerStat("Dexterity").getAmount() + " (+" + equipment["DEX"] + ")";
|
||||
GameObject.Find("txtIntelligence").GetComponent<Text>().text = "INT: " + player.getPlayerStat("Intelligence").getAmount() + " (+" + equipment["INT"] + ")";
|
||||
GameObject.Find("txtHealth").GetComponent<Text>().text = TextHandler.getText("health") + " " + player.getPlayerStat("Health").getAmount() + " (+" + equipment["HP"] + ")";
|
||||
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + player.getPlayerStat("Secondary").getAmount() + " (+" + equipment["MP"] + ")";
|
||||
GameObject.Find("txtHealth").GetComponent<Text>().text = TextHandler.getText("health") + " " + player.getPlayerStat("MaxHealth").getAmount() + " (+" + equipment["HP"] + ")";
|
||||
GameObject.Find("txtSecondary").GetComponent<Text>().text = "Mana: " + player.getPlayerStat("MaxSecondary").getAmount() + " (+" + equipment["MP"] + ")";
|
||||
|
||||
player.updateName(GameObject.Find("txtName").GetComponent<Text>());
|
||||
updatePoints(player.getPlayerStat("Points").getAmount());
|
||||
@@ -447,14 +432,18 @@ namespace Assets.Scripts
|
||||
{
|
||||
Dictionary<string, int> equipment = inventory.GetComponent<Inventory>().getEquipmentBonus();
|
||||
|
||||
GameObject information = GameObject.Find("txtInformationHUD");
|
||||
GameObject information = GameObject.Find("txtPlayerInformationHUD");
|
||||
player.updateNameHUD(information.GetComponent<Text>());
|
||||
|
||||
GameObject fill = GameObject.Find("HUD_healthFill");
|
||||
updateFill(fill, null, player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"], player.getPlayerStat("Health").getAmount());
|
||||
GameObject foreground = GameObject.Find("healthForegroundPlayer");
|
||||
GameObject background = GameObject.Find("healthBackgroundPlayer");
|
||||
GameObject text = GameObject.Find("healthTextPlayer");
|
||||
updateBar(foreground, background, text, player.getPlayerStat("MaxHealth").getAmount() + equipment["HP"], player.getPlayerStat("Health").getAmount());
|
||||
|
||||
fill = GameObject.Find("HUD_secondaryFill");
|
||||
updateFill(fill, null, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
|
||||
foreground = GameObject.Find("secondaryForegroundPlayer");
|
||||
background = GameObject.Find("secondaryBackgroundPlayer");
|
||||
text = GameObject.Find("secondaryTextPlayer");
|
||||
updateBar(foreground, background, text, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
|
||||
}
|
||||
|
||||
public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue)
|
||||
@@ -475,22 +464,6 @@ namespace Assets.Scripts
|
||||
bar.GetComponent<RectTransform>().offsetMax = new Vector2(-change, bar.GetComponent<RectTransform>().offsetMax.y);
|
||||
}
|
||||
|
||||
public void updateFill(GameObject fill, GameObject textField, int maxValue, int minValue)
|
||||
{
|
||||
string text = minValue + "/" + maxValue;
|
||||
float percentage = 0;
|
||||
if (maxValue > 0)
|
||||
{
|
||||
percentage = (1 / (float)maxValue) * minValue;
|
||||
}
|
||||
|
||||
if (textField != null)
|
||||
{
|
||||
textField.GetComponent<Text>().text = text;
|
||||
}
|
||||
fill.GetComponent<Image>().fillAmount = percentage;
|
||||
}
|
||||
|
||||
public void openIntroduction()
|
||||
{
|
||||
GameObject.Find("AudioHandler").GetComponent<AudioHandler>().Start();
|
||||
|
||||
@@ -51,7 +51,6 @@ namespace Assets.Scripts
|
||||
statBoost = new Dictionary<string, int>();
|
||||
statBoost.Add("HP", 0);
|
||||
statBoost.Add("MP", 0);
|
||||
statBoost.Add("HPR", 0);
|
||||
statBoost.Add("MPR", 0);
|
||||
statBoost.Add("STR", 0);
|
||||
statBoost.Add("DEX", 0);
|
||||
@@ -76,8 +75,8 @@ namespace Assets.Scripts
|
||||
{
|
||||
slots[j].GetComponent<InventorySlot>().setItem(item, i);
|
||||
itemAdded = true;
|
||||
slots[j].GetComponent<RawImage>().color = item.rarityColor;
|
||||
slots[j].GetComponent<RawImage>().texture = item.image;
|
||||
slots[j].transform.Find("slotItem").GetComponent<RawImage>().color = item.rarityColor;
|
||||
slots[j].transform.Find("slotItem").GetComponent<RawImage>().texture = item.image;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -119,13 +118,13 @@ namespace Assets.Scripts
|
||||
item = slots[i].GetComponent<InventorySlot>().getItem(currentBag);
|
||||
if (item != null)
|
||||
{
|
||||
slots[i].GetComponent<RawImage>().color = item.rarityColor;
|
||||
slots[i].GetComponent<RawImage>().texture = item.image;
|
||||
slots[i].transform.Find("slotItem").GetComponent<RawImage>().color = item.rarityColor;
|
||||
slots[i].transform.Find("slotItem").GetComponent<RawImage>().texture = item.image;
|
||||
}
|
||||
else
|
||||
{
|
||||
slots[i].GetComponent<RawImage>().color = Color.white;
|
||||
slots[i].GetComponent<RawImage>().texture = null;
|
||||
slots[i].transform.Find("slotItem").GetComponent<RawImage>().color = new Color(1,1,1,0);
|
||||
slots[i].transform.Find("slotItem").GetComponent<RawImage>().texture = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -163,12 +162,12 @@ namespace Assets.Scripts
|
||||
item = slot.GetComponent<InventorySlot>().getEquip();
|
||||
if (item != null)
|
||||
{
|
||||
slot.GetComponent<RawImage>().color = item.rarityColor;
|
||||
slot.GetComponent<RawImage>().texture = item.image;
|
||||
slot.transform.Find("slotItem").GetComponent<RawImage>().color = item.rarityColor;
|
||||
slot.transform.Find("slotItem").GetComponent<RawImage>().texture = item.image;
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.GetComponent<RawImage>().color = Color.white;
|
||||
slot.transform.Find("slotItem").GetComponent<RawImage>().color = Color.white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace Assets.Scripts
|
||||
}
|
||||
if (image != null)
|
||||
{
|
||||
gameObject.GetComponent<RawImage>().texture = image;
|
||||
gameObject.transform.Find("slotItem").GetComponent<RawImage>().texture = image;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,6 @@ namespace Assets.Scripts
|
||||
{
|
||||
attributes.Add("MPR", int.Parse(json["MPR"].ToString()));
|
||||
}
|
||||
if (json["HPR"] != null)
|
||||
{
|
||||
attributes.Add("HPR", int.Parse(json["HPR"].ToString()));
|
||||
}
|
||||
if (json["MP"] != null)
|
||||
{
|
||||
attributes.Add("MP", int.Parse(json["MP"].ToString()));
|
||||
@@ -192,13 +188,6 @@ namespace Assets.Scripts
|
||||
attributes.Add("MP", Mathf.RoundToInt((float)(10 - (2 * i) + rand.Next(luck) * 0.1)));
|
||||
break;
|
||||
case 7:
|
||||
if (i == 0)
|
||||
{
|
||||
itemName = "health regeneration";
|
||||
}
|
||||
attributes.Add("HPR", Mathf.RoundToInt((float)(3 - (2 * i) + rand.Next(luck) * 0.1)));
|
||||
break;
|
||||
case 8:
|
||||
if (i == 0)
|
||||
{
|
||||
itemName = "mana regeneration";
|
||||
@@ -213,7 +202,6 @@ namespace Assets.Scripts
|
||||
{
|
||||
int bonus = rand.Next(luck);
|
||||
attributes.Add("MPR", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
|
||||
attributes.Add("HPR", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
|
||||
attributes.Add("MP", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
|
||||
attributes.Add("HP", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
|
||||
attributes.Add("STR", Mathf.RoundToInt((float)(3 + bonus * 0.1)));
|
||||
@@ -229,7 +217,7 @@ namespace Assets.Scripts
|
||||
int index = 0;
|
||||
while (true)
|
||||
{
|
||||
index = rand.Next(8) + 1;
|
||||
index = rand.Next(8);
|
||||
counter = 0;
|
||||
for (int j = 0; j < indexes.Length; j++)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Assets.Scripts
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (messages.Count > 0 && GameObject.Find("Fight").transform.localScale.Equals(new Vector3(0, 0, 0)))
|
||||
if (messages.Count > 0)
|
||||
{
|
||||
if (!isDisplaying)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Assets.Scripts.Player
|
||||
UIHandler uihandler;
|
||||
GameObject player;
|
||||
Vector2 rotation = Vector2.zero;
|
||||
public float mouseSpeed = 1; //the sensibility
|
||||
public float mouseSpeed = 100; //the sensibility
|
||||
public float controllerSpeed = 0.01f; //the sensibility
|
||||
float xMaxLimit = 50.0f;
|
||||
float xMinLimit = -50.0f;
|
||||
@@ -22,14 +22,14 @@ namespace Assets.Scripts.Player
|
||||
uihandler = GameObject.Find("UIHandler").GetComponent<UIHandler>();
|
||||
player = gameObject.transform.parent.gameObject;
|
||||
interact = GameObject.Find("pnlInteract");
|
||||
interact.transform.localScale = new Vector3(0,0,0);
|
||||
interact.transform.localScale = new Vector3(0, 0, 0);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.position = new Vector3(transform.parent.transform.position.x, transform.position.y, transform.parent.transform.position.z);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
@@ -37,15 +37,19 @@ namespace Assets.Scripts.Player
|
||||
showInformation();
|
||||
}
|
||||
|
||||
public void lookAround(Vector2 view, bool isController){
|
||||
public void lookAround(Vector2 view, bool isController)
|
||||
{
|
||||
rotation.y += view.x;
|
||||
rotation.x += -view.y;
|
||||
rotation.x = Mathf.Clamp(rotation.x, xMinLimit, xMaxLimit);
|
||||
if(isController){
|
||||
transform.eulerAngles = (Vector2)rotation * controllerSpeed;
|
||||
//rotation.x = Mathf.Clamp(rotation.x, xMinLimit, xMaxLimit);
|
||||
if (isController)
|
||||
{
|
||||
transform.eulerAngles = rotation * (controllerSpeed * Time.deltaTime);
|
||||
}
|
||||
else{
|
||||
transform.eulerAngles = (Vector2)rotation * mouseSpeed;
|
||||
else
|
||||
{
|
||||
transform.eulerAngles = rotation * mouseSpeed;
|
||||
//TODO: Look at camera movement -> Not rly smooth. Weird drag
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,14 +69,18 @@ namespace Assets.Scripts.Player
|
||||
void showInformation()
|
||||
{
|
||||
RaycastHit hit;
|
||||
interact.transform.localScale = new Vector3(0,0,0);
|
||||
interact.transform.localScale = new Vector3(0, 0, 0);
|
||||
if (Physics.Raycast(transform.position, transform.forward, out hit, Mathf.Infinity))
|
||||
{
|
||||
if (hit.collider.gameObject.tag.ToLower().Contains("object"))
|
||||
{
|
||||
string obj = hit.collider.gameObject.tag.Split(':')[1];
|
||||
if(hit.distance <= 3 && !obj.ToLower().Equals("house")){
|
||||
interact.transform.localScale = new Vector3(1,1,1);
|
||||
if (hit.distance <= 3 && !obj.ToLower().Equals("house"))
|
||||
{
|
||||
if (!uihandler.isPlayerInFight())
|
||||
{
|
||||
interact.transform.localScale = new Vector3(1, 1, 1);
|
||||
}
|
||||
}
|
||||
switch (obj.ToLower())
|
||||
{
|
||||
@@ -98,16 +106,20 @@ namespace Assets.Scripts.Player
|
||||
displayInformation(TextHandler.getText("chest"));
|
||||
break;
|
||||
case "ore":
|
||||
if(hit.collider.gameObject.name.ToLower().Contains("iron")){
|
||||
if (hit.collider.gameObject.name.ToLower().Contains("iron"))
|
||||
{
|
||||
displayInformation(TextHandler.translate("Iron ore"));
|
||||
}
|
||||
else if(hit.collider.gameObject.name.ToLower().Contains("gold")){
|
||||
else if (hit.collider.gameObject.name.ToLower().Contains("gold"))
|
||||
{
|
||||
displayInformation(TextHandler.translate("Gold ore"));
|
||||
}
|
||||
else if(hit.collider.gameObject.name.ToLower().Contains("copper")){
|
||||
else if (hit.collider.gameObject.name.ToLower().Contains("copper"))
|
||||
{
|
||||
displayInformation(TextHandler.translate("Copper ore"));
|
||||
}
|
||||
else if(hit.collider.gameObject.name.ToLower().Contains("tin")){
|
||||
else if (hit.collider.gameObject.name.ToLower().Contains("tin"))
|
||||
{
|
||||
displayInformation(TextHandler.translate("Tin ore"));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Assets.Scripts.Player
|
||||
{
|
||||
now = DateTime.Now;
|
||||
player.regainSecondary(inventory.getEquipmentBonus()["MPR"], inventory.getEquipmentBonus()["MP"]);
|
||||
player.healPlayer(inventory.getEquipmentBonus()["HPR"], inventory.getEquipmentBonus()["HP"]);
|
||||
player.healPlayer(4 - difficulty * 2, inventory.getEquipmentBonus()["HP"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -229,6 +229,12 @@ namespace Assets.Scripts.Player
|
||||
worldGenerator.createTile(new Vector3(1,0,1));
|
||||
}
|
||||
|
||||
if(col.name.Contains("House")){
|
||||
if(!col.transform.Find("Door").GetComponent<Door>().hasInteracted){
|
||||
transform.position = new Vector3(transform.position.x + 10, 10, transform.position.z);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void displayAction(int index, GameObject image, GameObject desc)
|
||||
@@ -260,7 +266,7 @@ namespace Assets.Scripts.Player
|
||||
|
||||
public void updateNameHUD(Text nameUI)
|
||||
{
|
||||
nameUI.text = player.getPlayerName() + "\n\r" + TextHandler.getText(player.getRace().racename) + "/" + TextHandler.getText(player.getClass().classname) + "\r\n Lvl. " + player.getStat("Level").getAmount();
|
||||
nameUI.text = player.getPlayerName() + "(Lvl. " + player.getStat("Level").getAmount() + ")";
|
||||
}
|
||||
|
||||
public void upgradeStrength()
|
||||
@@ -343,14 +349,21 @@ namespace Assets.Scripts.Player
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
return player.takeDamage(amount, inventory.getEquipmentBonus()["DEX"], inventory.getEquipmentBonus()["INT"]);
|
||||
if(player.takeDamage(amount, inventory.getEquipmentBonus()["DEX"], inventory.getEquipmentBonus()["INT"])){
|
||||
audioHandler.playDamage();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int castSkill(int skillnumber)
|
||||
{
|
||||
return player.castSkill(skillnumber, inventory.getEquipmentBonus()["INT"], inventory.getEquipmentBonus()["STR"], inventory.getEquipmentBonus()["DEX"]);
|
||||
int damage = player.castSkill(skillnumber, inventory.getEquipmentBonus()["INT"], inventory.getEquipmentBonus()["STR"], inventory.getEquipmentBonus()["DEX"]);
|
||||
if(damage > 0){
|
||||
player.getSkill(skillnumber).playSound(audioHandler);
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
public void reduceCooldown(int skillnumber)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Assets.Scripts.Player
|
||||
this.difficulty = difficulty;
|
||||
generateStats(false);
|
||||
generateSkills();
|
||||
EasterEggHandler.applyEasterEgg(this);
|
||||
EasterEggHandler.applyEasterEgg(playername);
|
||||
}
|
||||
|
||||
public PlayerObject()
|
||||
@@ -45,7 +45,6 @@ namespace Assets.Scripts.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("HealthRegen", new PlayerStat("HealthRegen", 30 / (difficulty + 1), "The current health regen 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"));
|
||||
@@ -107,7 +106,6 @@ namespace Assets.Scripts.Player
|
||||
stats["MaxExperience"].setAmount((int)json["maxExperience"]);
|
||||
stats["Points"].setAmount((int)json["points"]);
|
||||
stats["Luck"].setAmount((int)json["luck"]);
|
||||
stats["HealthRegen"].setAmount((int)json["healthRegen"]);
|
||||
stats["SecondaryRegen"].setAmount((int)json["secondaryRegen"]);
|
||||
stats["Killcount"].setAmount((int)json["killcount"]);
|
||||
|
||||
@@ -176,9 +174,9 @@ namespace Assets.Scripts.Player
|
||||
}
|
||||
}
|
||||
|
||||
public void healPlayer(int equipRegen, int equipStat)
|
||||
public void healPlayer(int regeneration, int equipStat)
|
||||
{
|
||||
stats["Health"].changeAmount(stats["HealthRegen"].getAmount() + equipRegen);
|
||||
stats["Health"].changeAmount(regeneration);
|
||||
if (stats["Health"].getAmount() >= stats["MaxHealth"].getAmount() + equipStat)
|
||||
{
|
||||
stats["Health"].setAmount(stats["MaxHealth"].getAmount() + equipStat);
|
||||
@@ -260,7 +258,6 @@ namespace Assets.Scripts.Player
|
||||
damage = damage / 2;
|
||||
break;
|
||||
}
|
||||
//TODO: Let caller of this method handle audio if damage is higher than 0 // skills[index].playSound(audioHandler);
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
@@ -299,7 +296,6 @@ namespace Assets.Scripts.Player
|
||||
if (rand.Next(1, 101) > dodgeChance)
|
||||
{
|
||||
stats["Health"].changeAmount(-amount);
|
||||
//TODO: Let caller of this method handle audio // audioHandler.playDamage();
|
||||
}
|
||||
}
|
||||
return stats["Health"].getAmount() <= 0;
|
||||
@@ -370,7 +366,6 @@ namespace Assets.Scripts.Player
|
||||
result = result + FileHandler.generateJSON("race", "\"" + race.racename + "\"") + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("role", "\"" + role.classname + "\"") + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("points", stats["Points"].getAmount()) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("healthRegen", stats["HealthRegen"].getAmount()) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("secondaryRegen", stats["SecondaryRegen"].getAmount()) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("isDodging", "\"" + isDodging + "\"") + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("killcount", stats["Killcount"].getAmount()) + ",\r\n";
|
||||
|
||||
@@ -36,16 +36,30 @@ public class Tile : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<Vector3> getSpawnLocations()
|
||||
{
|
||||
List<Vector3> list = new List<Vector3>();
|
||||
int objectAmount = rand.Next(20, 101);
|
||||
int objectAmount = objectAmount = rand.Next(40, 151);
|
||||
int iterations = 0;
|
||||
Vector3 newPoint;
|
||||
bool canSpawn;
|
||||
while(list.Count < objectAmount){
|
||||
iterations++;
|
||||
canSpawn = true;
|
||||
newPoint = new Vector3(rand.Next(-40, 40) + 100 * position.x, 50, rand.Next(-40, 40) + 100 * position.z);
|
||||
if (!list.Contains(newPoint))
|
||||
{
|
||||
foreach(Vector3 vector in list){
|
||||
if(Vector3.Distance(vector, newPoint) < 10){
|
||||
canSpawn = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(canSpawn && !list.Contains(newPoint)){
|
||||
list.Add(newPoint);
|
||||
iterations = 0;
|
||||
}
|
||||
if(iterations >= 1000){
|
||||
break;
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -60,19 +74,6 @@ public class Tile : MonoBehaviour
|
||||
GameObject content = contentGenerator.GetComponent<ContentGenerator>().generateContent(tiletype.ToString());
|
||||
if (content != null)
|
||||
{
|
||||
float verticeX = position.x / 10;
|
||||
float verticeZ = position.z / 10;
|
||||
|
||||
Vector3 vertice = new Vector3(Mathf.Round(verticeX), 0, Mathf.Round(verticeZ));
|
||||
Vector3[] vertices = gameObject.GetComponent<MeshFilter>().mesh.vertices;
|
||||
|
||||
foreach(Vector3 v in vertices){
|
||||
if(v.x == vertice.x && v.z == vertice.z){
|
||||
position.y = v.y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GameObject obj = Instantiate(content, position, Quaternion.identity, gameObject.transform);
|
||||
if (obj.tag.Contains("Enemy"))
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ public class WorldGenerator : MonoBehaviour
|
||||
Destroy(tile);
|
||||
}
|
||||
}
|
||||
player.transform.position = new Vector3(0, 50f, 0);
|
||||
player.transform.position = new Vector3(0, 50, 0);
|
||||
player.transform.rotation = Quaternion.identity;
|
||||
OnEnable();
|
||||
this.cityAmount = cityAmount;
|
||||
@@ -95,7 +95,6 @@ public class WorldGenerator : MonoBehaviour
|
||||
noise.applyNoise(newTile, tiles, pos);
|
||||
newTile.GetComponent<Tile>().generateTile(pos, (TileType)Enum.Parse(typeof(TileType), newTile.name.Split("_")[0]));
|
||||
tiles.Add(pos, newTile);
|
||||
//currentTile = newTile;
|
||||
GameObject.Find("QuestLog").GetComponent<QuestLog>().updateQuests("find", newTile, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user