Added player task system. simple interaction with objects. Known issue - no player stats canvas

This commit is contained in:
Vladimir Koshevarov
2023-02-21 18:58:06 +02:00
parent 7c26b80584
commit 59d2f7cc30
46 changed files with 2289 additions and 3121 deletions
@@ -11,7 +11,6 @@ public class ConversationController : MonoBehaviour
[SerializeField] public Button _choiceButton;
[SerializeField] private Button _btnApply;
[SerializeField] private Button _btnClose;
[SerializeField] PlayerManager _playerManager;
public ConversationChangeEvent conversationChangeEvent;
private List<ChoiceController> choiceControllers = new();
@@ -37,7 +36,7 @@ public class ConversationController : MonoBehaviour
ApplyActionOnPlayer(_selectedAction);
});
_playerManager.allowMovement = false;
Player.Instance.allowMovement = false;
RemoveChoices();
_title.text = title;
gameObject.SetActive(true);
@@ -60,14 +59,14 @@ public class ConversationController : MonoBehaviour
_selectedAction = action;
if (action is ISellable)
{
_btnApply.interactable = _playerManager.PlayerStats[GameManager.StatsId.Money].Value >= (action as ISellable).Price;
_btnApply.interactable = Player.Instance.PlayerStats[StatsId.Money].Value >= (action as ISellable).Price;
}
}
private void ApplyActionOnPlayer(IPlayerAction action)
{
if (action is ISellable)
_playerManager.BuyAction(action);
Player.Instance.BuyAction(action);
}
private void RemoveChoices()
{
@@ -84,6 +83,6 @@ public class ConversationController : MonoBehaviour
RemoveChoices();
gameObject.SetActive(false);
Time.timeScale = 1;
_playerManager.allowMovement = true;
Player.Instance.allowMovement = true;
}
}