fixed ui, localization and save/load
This commit is contained in:
@@ -40,7 +40,7 @@ namespace Assets.Scripts.Player
|
||||
|
||||
if (GameObject.Find("Inventory") != null)
|
||||
{
|
||||
inventory = GameObject.Find("Inventory").GetComponent<Inventory>();
|
||||
inventory = GameObject.Find("Inventory").GetComponent<Inventory>();
|
||||
}
|
||||
if (GameObject.Find("WorldGenerator") != null)
|
||||
{
|
||||
@@ -77,8 +77,8 @@ namespace Assets.Scripts.Player
|
||||
if (now.AddSeconds(10).CompareTo(DateTime.Now) <= 0)
|
||||
{
|
||||
now = DateTime.Now;
|
||||
player.regainSecondary(inventory.getEquipmentBonus()["MPR"],inventory.getEquipmentBonus()["MP"]);
|
||||
player.healPlayer(inventory.getEquipmentBonus()["HPR"],inventory.getEquipmentBonus()["HP"]);
|
||||
player.regainSecondary(inventory.getEquipmentBonus()["MPR"], inventory.getEquipmentBonus()["MP"]);
|
||||
player.healPlayer(inventory.getEquipmentBonus()["HPR"], inventory.getEquipmentBonus()["HP"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,8 @@ namespace Assets.Scripts.Player
|
||||
player = new PlayerObject(playername, race, role, difficulty);
|
||||
}
|
||||
|
||||
public void generatePlayer(BasicRace playerRace, BasicClass playerClass, string name, int difficulty){
|
||||
public void generatePlayer(BasicRace playerRace, BasicClass playerClass, string name, int difficulty)
|
||||
{
|
||||
player = new PlayerObject(name, playerRace, playerClass, difficulty);
|
||||
}
|
||||
|
||||
@@ -213,35 +214,20 @@ namespace Assets.Scripts.Player
|
||||
}
|
||||
void OnTriggerEnter(Collider col)
|
||||
{
|
||||
if (col.gameObject.name.Contains("_"))
|
||||
if (col.name.Contains("_"))
|
||||
{
|
||||
worldGenerator.changeCurrentTile(col.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerStay(Collider col)
|
||||
{
|
||||
if (col.gameObject.name.Contains("border"))
|
||||
{
|
||||
Vector3 newTile = new Vector3();
|
||||
if (col.gameObject.name.ToLower() == "bordernorth")
|
||||
{
|
||||
newTile = newTile + new Vector3(0, 0, 1);
|
||||
}
|
||||
if (col.gameObject.name.ToLower() == "bordersouth")
|
||||
{
|
||||
newTile = newTile + new Vector3(0, 0, -1);
|
||||
}
|
||||
if (col.gameObject.name.ToLower() == "bordereast")
|
||||
{
|
||||
newTile = newTile + new Vector3(1, 0, 0);
|
||||
}
|
||||
if (col.gameObject.name.ToLower() == "borderwest")
|
||||
{
|
||||
newTile = newTile + new Vector3(-1, 0, 0);
|
||||
}
|
||||
worldGenerator.createTile(newTile);
|
||||
worldGenerator.createTile(new Vector3(-1,0,-1));
|
||||
worldGenerator.createTile(new Vector3(0,0,-1));
|
||||
worldGenerator.createTile(new Vector3(1,0,-1));
|
||||
worldGenerator.createTile(new Vector3(-1,0,0));
|
||||
worldGenerator.createTile(new Vector3(1,0,0));
|
||||
worldGenerator.createTile(new Vector3(-1,0,1));
|
||||
worldGenerator.createTile(new Vector3(0,0,1));
|
||||
worldGenerator.createTile(new Vector3(1,0,1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void displayAction(int index, GameObject image, GameObject desc)
|
||||
@@ -316,51 +302,63 @@ namespace Assets.Scripts.Player
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerStat getPlayerStat(string identifier){
|
||||
public PlayerStat getPlayerStat(string identifier)
|
||||
{
|
||||
return player.getStat(identifier);
|
||||
}
|
||||
|
||||
public void loadPlayer(JToken json){
|
||||
public void loadPlayer(JToken json)
|
||||
{
|
||||
player = new PlayerObject();
|
||||
player.loadPlayer(json);
|
||||
}
|
||||
|
||||
public PlayerObject getPlayer(){
|
||||
public PlayerObject getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
public string saveGame(){
|
||||
public string saveGame()
|
||||
{
|
||||
return player.saveGame();
|
||||
}
|
||||
|
||||
public BasicClass getClass(){
|
||||
public BasicClass getClass()
|
||||
{
|
||||
return player.getClass();
|
||||
}
|
||||
|
||||
public BasicRace getRace(){
|
||||
public BasicRace getRace()
|
||||
{
|
||||
return player.getRace();
|
||||
}
|
||||
|
||||
public int calculateDamage(){
|
||||
public int calculateDamage()
|
||||
{
|
||||
return player.calculateDamage(inventory.getEquipmentBonus()["STR"], inventory.getEquipmentBonus()["DEX"]);
|
||||
}
|
||||
|
||||
public bool takeDamage(int amount){
|
||||
if(player != null){
|
||||
return player.takeDamage(amount,inventory.getEquipmentBonus()["DEX"], inventory.getEquipmentBonus()["INT"]);
|
||||
public bool takeDamage(int amount)
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
return player.takeDamage(amount, inventory.getEquipmentBonus()["DEX"], inventory.getEquipmentBonus()["INT"]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int castSkill(int skillnumber){
|
||||
return player.castSkill(skillnumber,inventory.getEquipmentBonus()["INT"], inventory.getEquipmentBonus()["STR"], inventory.getEquipmentBonus()["DEX"]);
|
||||
public int castSkill(int skillnumber)
|
||||
{
|
||||
return player.castSkill(skillnumber, inventory.getEquipmentBonus()["INT"], inventory.getEquipmentBonus()["STR"], inventory.getEquipmentBonus()["DEX"]);
|
||||
}
|
||||
|
||||
public void reduceCooldown(int skillnumber){
|
||||
public void reduceCooldown(int skillnumber)
|
||||
{
|
||||
player.reduceCooldown(skillnumber);
|
||||
}
|
||||
|
||||
public void regainSecondary(){
|
||||
public void regainSecondary()
|
||||
{
|
||||
player.regainSecondary(inventory.getEquipmentBonus()["MPR"], inventory.getEquipmentBonus()["MP"]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user