39 lines
865 B
C#
39 lines
865 B
C#
using System.Collections;
|
|
using UnityEngine;
|
|
|
|
|
|
public class PlayerActions : MonoBehaviour
|
|
{
|
|
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void GetReward(MissionReward reward)
|
|
{
|
|
// 1. Add items to equipment
|
|
foreach(var item in reward.Items)
|
|
{
|
|
InventoryUIManager.Instance.Add(item);
|
|
}
|
|
|
|
|
|
// 2. Add cash
|
|
AccountBalanceManager.Instance.IncreaseAccountBalanceValue(reward.Cash);
|
|
Debug.Log($"Give reward - {reward.Cash}");
|
|
|
|
// 3. Save changes
|
|
GameObject.FindObjectOfType<SaveController>().SavePlayerEquipmentItems();
|
|
GameObject.FindObjectOfType<SaveController>().SavePlayerInventory();
|
|
GameObject.FindObjectOfType<SaveController>().SaveAccountBalance();
|
|
}
|
|
}
|