Lumberjack - getting reward after quest

This commit is contained in:
kabix09 2023-01-05 16:52:57 +01:00
parent ea2879c9ff
commit 1b36194f31
5 changed files with 36 additions and 3 deletions

View File

@ -19,6 +19,7 @@ GameObject:
- component: {fileID: 4869648843286970676} - component: {fileID: 4869648843286970676}
- component: {fileID: 4869648843286970678} - component: {fileID: 4869648843286970678}
- component: {fileID: 4869648843286970673} - component: {fileID: 4869648843286970673}
- component: {fileID: -4072721723537361924}
m_Layer: 0 m_Layer: 0
m_Name: ThePlayer m_Name: ThePlayer
m_TagString: Player m_TagString: Player
@ -118,11 +119,18 @@ MonoBehaviour:
walkSpeed: 10 walkSpeed: 10
Panel: {fileID: 0} Panel: {fileID: 0}
dmgParticleSystem: {fileID: 4869648843387222763} dmgParticleSystem: {fileID: 4869648843387222763}
maxHealth: {fileID: 11400000, guid: 2cac7af95874b184aae736e0ed4994d7, type: 2}
currentHealth: 10
healthBar: {fileID: 0} healthBar: {fileID: 0}
lvlUp: 0 lvlUp: 0
test: 0 test: 0
healthPoints: 0
defensePoints: 0
strengthPoints: 0
intelligencePoints: 0
attackValue: 0
defenseValue: 0
currentSpeed: 0
currentHealth: 10
maxHealth: 0
exp: 0 exp: 0
lvl: 0 lvl: 0
maxExp: 0 maxExp: 0
@ -270,6 +278,18 @@ MonoBehaviour:
- E-InteractivePanelAbove - E-InteractivePanelAbove
- Spacebar-InteractivePanel - Spacebar-InteractivePanel
- Spacebar-InteractivePanelAbove - Spacebar-InteractivePanelAbove
--- !u!114 &-4072721723537361924
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4869648843286970700}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b706d33712b371949b5623cdf98fc4a4, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &4869648843387222766 --- !u!1 &4869648843387222766
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -332,6 +332,9 @@ public class NPCDialogue : MonoBehaviour
else else
TaskUIManager.Instance.RemoveByName(gameObject.GetComponent<NPCQuest>().quest.Title); TaskUIManager.Instance.RemoveByName(gameObject.GetComponent<NPCQuest>().quest.Title);
// 4. Get reward
GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerActions>().GetReward(gameObject.GetComponent<NPCQuest>().reward);
// 3. Set as finished // 3. Set as finished
isQuest = 3; isQuest = 3;
EndDialogue(); EndDialogue();

View File

@ -14,6 +14,8 @@ public class NPCQuest : MonoBehaviour
[SerializeField] private bool isTaskAccepted = false; [SerializeField] private bool isTaskAccepted = false;
[SerializeField] public MissionReward reward;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {

View File

@ -11,6 +11,9 @@ public class MissionReward
[SerializeField] [SerializeField]
public int Cash = 0; public int Cash = 0;
[SerializeField]
public int Experience = 0;
public MissionReward() { } public MissionReward() { }
public MissionReward(List<EquippableItem> _items, int _cash) public MissionReward(List<EquippableItem> _items, int _cash)

View File

@ -28,7 +28,10 @@ public class PlayerActions : MonoBehaviour
// 2. Add cash // 2. Add cash
AccountBalanceManager.Instance.IncreaseAccountBalanceValue(reward.Cash); AccountBalanceManager.Instance.IncreaseAccountBalanceValue(reward.Cash);
Debug.Log($"Give reward - {reward.Cash}"); //Debug.Log($"Give reward - {reward.Cash}");
// 3. Add experience points
gameObject.GetComponent<Player>().GetExp(reward.Experience);
// 3. Save changes // 3. Save changes
// TODO - sync saving process reward / mission proggress // TODO - sync saving process reward / mission proggress
@ -36,5 +39,7 @@ public class PlayerActions : MonoBehaviour
//GameObject.FindObjectOfType<SaveController>().SavePlayerEquipmentItems(); //GameObject.FindObjectOfType<SaveController>().SavePlayerEquipmentItems();
//GameObject.FindObjectOfType<SaveController>().SavePlayerInventory(); //GameObject.FindObjectOfType<SaveController>().SavePlayerInventory();
//GameObject.FindObjectOfType<SaveController>().SaveAccountBalance(); //GameObject.FindObjectOfType<SaveController>().SaveAccountBalance();
// save exp
} }
} }