Scriptum/Assets/Scripts/REFACTORING/Application/Player/PlayerActions.cs

46 lines
1.1 KiB
C#
Raw Permalink Normal View History

2022-12-04 18:42:34 +01:00
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);
}
2022-12-27 15:16:59 +01:00
// 2. Add cash
AccountBalanceManager.Instance.IncreaseAccountBalanceValue(reward.Cash);
//Debug.Log($"Give reward - {reward.Cash}");
// 3. Add experience points
gameObject.GetComponent<Player>().GetExp(reward.Experience);
2022-12-27 15:16:59 +01:00
// 3. Save changes
2023-01-03 22:44:24 +01:00
// TODO - sync saving process reward / mission proggress
// currently its saving only after changing scene and saving manually by player
//GameObject.FindObjectOfType<SaveController>().SavePlayerEquipmentItems();
//GameObject.FindObjectOfType<SaveController>().SavePlayerInventory();
//GameObject.FindObjectOfType<SaveController>().SaveAccountBalance();
// save exp
2022-12-04 18:42:34 +01:00
}
}