CleanupCode add eating
This commit is contained in:
@@ -1863,7 +1863,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 808129671576928264, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 808129671576928264, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 0
|
value: 20
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 808129671576928264, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 808129671576928264, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
@@ -1888,7 +1888,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 896272491191485165, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 896272491191485165, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 0
|
value: 182.005
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 896272491191485165, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 896272491191485165, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
@@ -2013,22 +2013,22 @@ PrefabInstance:
|
|||||||
- target: {fileID: 4307980429506515175, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 4307980429506515175, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchorMax.y
|
propertyPath: m_AnchorMax.y
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4307980429506515175, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 4307980429506515175, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchorMin.y
|
propertyPath: m_AnchorMin.y
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4307980429506515175, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 4307980429506515175, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 0
|
value: 250
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4307980429506515175, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 4307980429506515175, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchoredPosition.y
|
propertyPath: m_AnchoredPosition.y
|
||||||
value: 0
|
value: -90
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 4537241548631189332, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 4537241548631189332, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
@@ -2123,7 +2123,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 6551138445549304010, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 6551138445549304010, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 0
|
value: 182.005
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 6551138445549304010, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 6551138445549304010, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
@@ -2248,7 +2248,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 7883991513978601488, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 7883991513978601488, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 0
|
value: 182.005
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7883991513978601488, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 7883991513978601488, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
@@ -2268,12 +2268,12 @@ PrefabInstance:
|
|||||||
- target: {fileID: 7949779033593405736, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 7949779033593405736, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_SizeDelta.x
|
propertyPath: m_SizeDelta.x
|
||||||
value: 0
|
value: 364.01
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7949779033593405736, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 7949779033593405736, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 0
|
value: 182.005
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 7949779033593405736, guid: 8939548f67eb43c4fa321f112c45f83b,
|
- target: {fileID: 7949779033593405736, guid: 8939548f67eb43c4fa321f112c45f83b,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 2e8ace0e753f18d41ae7374b31260efd
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
namespace Assets.Scripts.Actions
|
|
||||||
{
|
|
||||||
public abstract class BaseAction
|
|
||||||
{
|
|
||||||
protected int DurationInTicks { get; }
|
|
||||||
protected int ElapsedTicks { get; }
|
|
||||||
|
|
||||||
protected BaseAction(int durationTicks)
|
|
||||||
{
|
|
||||||
DurationInTicks = durationTicks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void ApplyAction(Player playerController);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e13454be9a4755a4cb902ce4492c0d47
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
using Assets.Scripts.Actions.Interfaces;
|
|
||||||
|
|
||||||
namespace Assets.Scripts.Actions
|
|
||||||
{
|
|
||||||
public class Eat : IPlayerAction, ISellable
|
|
||||||
{
|
|
||||||
public decimal Price { get; private set; }
|
|
||||||
|
|
||||||
public string Name { get; private set; }
|
|
||||||
|
|
||||||
public string Description => $"{Name} - {Price}$";
|
|
||||||
private int _energy;
|
|
||||||
|
|
||||||
public Eat(string name, int energy, decimal price)
|
|
||||||
{
|
|
||||||
Name = name;
|
|
||||||
Price = price;
|
|
||||||
_energy = energy;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void ApplyAction(Player playerController)
|
|
||||||
{
|
|
||||||
playerController.Stats[StatsId.Food].increase(_energy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 88b69afebf64e464981dc504941a0887
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 75ecd68a88c4c904393604b692b01a43
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
namespace Assets.Scripts.Actions.Interfaces
|
|
||||||
{
|
|
||||||
public enum JobId { Unemployed, HotDogs };
|
|
||||||
public interface IPlayerAction
|
|
||||||
{
|
|
||||||
public string Description { get; }
|
|
||||||
public void ApplyAction(Player player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface ISellable
|
|
||||||
{
|
|
||||||
public decimal Price { get; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IWorkPlace
|
|
||||||
{
|
|
||||||
public JobId JobID { get; }
|
|
||||||
public decimal Sallary { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 5b7ba6deb189bc44ca6f628a799c8667
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using Assets.Scripts.Actions.Interfaces;
|
|
||||||
|
|
||||||
namespace Assets.Scripts.Actions
|
|
||||||
{
|
|
||||||
public class JobPosition : IPlayerAction, IWorkPlace
|
|
||||||
{
|
|
||||||
public string Description => $"{_position} - {Sallary}$ per hour";
|
|
||||||
public decimal Sallary { get; private set; }
|
|
||||||
public JobId JobID { get; private set; }
|
|
||||||
|
|
||||||
|
|
||||||
private string _position;
|
|
||||||
|
|
||||||
public JobPosition(string position, decimal sallary, JobId jobId)
|
|
||||||
{
|
|
||||||
_position = position;
|
|
||||||
Sallary = sallary;
|
|
||||||
}
|
|
||||||
public void ApplyAction(Player playerController)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 80cfc634ca94f1e4fa1726ca19eab626
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 46382eb4a7b5812458ddf7287b5a65ff
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: cdd8a9c61eebf384796c7c94453d3255
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
using Assets.Scripts.Actions.Interfaces;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Assets.Scripts.Buildings
|
|
||||||
{
|
|
||||||
public abstract class BaseCell : MonoBehaviour
|
|
||||||
{
|
|
||||||
protected string _name;
|
|
||||||
protected List<IPlayerAction> _optionsList;
|
|
||||||
[SerializeField]
|
|
||||||
private ConversationController _conversationController;
|
|
||||||
// Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
_optionsList = new List<IPlayerAction>();
|
|
||||||
Initialize();
|
|
||||||
BuildOptionsList();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
protected abstract void Initialize();
|
|
||||||
protected abstract void BuildOptionsList();
|
|
||||||
|
|
||||||
void OnTriggerEnter(Collider other)
|
|
||||||
{
|
|
||||||
_conversationController.Change(_name, _optionsList);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 8087167db9f5271408218993b0473a69
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
namespace Assets.Scripts.Buildings
|
|
||||||
{
|
|
||||||
public class Burger : BaseCell
|
|
||||||
{
|
|
||||||
protected override void Initialize()
|
|
||||||
{
|
|
||||||
_name = "Monolith burger";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void BuildOptionsList()
|
|
||||||
{
|
|
||||||
//_optionsList.Add("Hamburgers - 83$", new Eat(6, 10, 83));
|
|
||||||
//_optionsList.Add("Cheesburger - 94$", new Eat(6, 1, 94));
|
|
||||||
//_optionsList.Add("Astro chicken - 131$", new Eat(6, 1, 131));
|
|
||||||
//_optionsList.Add("Fries - 68$", new Eat(6, 1, 68));
|
|
||||||
//_optionsList.Add("Shakes - 108$", new Eat(6, 1, 108));
|
|
||||||
//_optionsList.Add("Colas - 73$", new Eat(6, 1, 73));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 61bf941dbcbd36f48bdd8f30b1b6c1f0
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using Assets.Scripts.Actions;
|
|
||||||
|
|
||||||
namespace Assets.Scripts.Buildings
|
|
||||||
{
|
|
||||||
public class HotDogs : BaseCell
|
|
||||||
{
|
|
||||||
protected override void Initialize()
|
|
||||||
{
|
|
||||||
_name = "Hot dogs";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void BuildOptionsList()
|
|
||||||
{
|
|
||||||
_optionsList.Add(new Eat("Hot Dog", 15, 20));
|
|
||||||
_optionsList.Add(new Eat("Cola", 10, 10));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 60f522567c8014c40a76002f2dc8e2e4
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
namespace Assets.Scripts.Buildings
|
|
||||||
{
|
|
||||||
public class House : BaseCell
|
|
||||||
{
|
|
||||||
protected override void BuildOptionsList()
|
|
||||||
{
|
|
||||||
//_optionsList.Add(new Relax("Rest", 6, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Initialize()
|
|
||||||
{
|
|
||||||
throw new System.NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 1a4df4c0f11d1a043b36f4ea6a31e4d7
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
using Assets.Scripts.Actions;
|
|
||||||
using Assets.Scripts.Actions.Interfaces;
|
|
||||||
|
|
||||||
namespace Assets.Scripts.Buildings
|
|
||||||
{
|
|
||||||
public class JobAgency : BaseCell
|
|
||||||
{
|
|
||||||
protected override void Initialize()
|
|
||||||
{
|
|
||||||
_name = "Job Agency";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void BuildOptionsList()
|
|
||||||
{
|
|
||||||
_optionsList.Add(new JobPosition("Hot Dogs sailer ", 20, JobId.HotDogs));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 16925e4f4154a004dadcfa7300af1bbe
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,45 +1,44 @@
|
|||||||
using Assets.Scripts.Actions.Interfaces;
|
//using TMPro;
|
||||||
using TMPro;
|
//using UnityEngine;
|
||||||
using UnityEngine;
|
//using UnityEngine.Events;
|
||||||
using UnityEngine.Events;
|
//using UnityEngine.UI;
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
[System.Serializable]
|
//[System.Serializable]
|
||||||
public class ConversationChangeEvent : UnityEvent<IPlayerAction> { }
|
//public class ConversationChangeEvent : UnityEvent<IPlayerAction> { }
|
||||||
|
|
||||||
public class ChoiceController : MonoBehaviour
|
//public class ChoiceController : MonoBehaviour
|
||||||
{
|
//{
|
||||||
public IPlayerAction _option;
|
// public IPlayerAction _option;
|
||||||
public ConversationChangeEvent conversationChangeEvent;
|
// public ConversationChangeEvent conversationChangeEvent;
|
||||||
// Update is called once per frame
|
// // Update is called once per frame
|
||||||
public static ChoiceController AddChoiceButton(Button choiceButtonTemplate, IPlayerAction option, int index)
|
// public static ChoiceController AddChoiceButton(Button choiceButtonTemplate, IPlayerAction option, int index)
|
||||||
{
|
// {
|
||||||
int buttonSpacing = -50;
|
// int buttonSpacing = -50;
|
||||||
|
|
||||||
Button button = Instantiate(choiceButtonTemplate);
|
// Button button = Instantiate(choiceButtonTemplate);
|
||||||
|
|
||||||
button.transform.SetParent(choiceButtonTemplate.transform.parent);
|
// button.transform.SetParent(choiceButtonTemplate.transform.parent);
|
||||||
button.transform.localScale = Vector3.one;
|
// button.transform.localScale = Vector3.one;
|
||||||
button.transform.localPosition = choiceButtonTemplate.transform.localPosition + new Vector3(0, index * buttonSpacing, 0);
|
// button.transform.localPosition = choiceButtonTemplate.transform.localPosition + new Vector3(0, index * buttonSpacing, 0);
|
||||||
button.name = option.Description;
|
// button.name = option.Description;
|
||||||
button.gameObject.SetActive(true);
|
// button.gameObject.SetActive(true);
|
||||||
ChoiceController choiceController = button.GetComponent<ChoiceController>();
|
// ChoiceController choiceController = button.GetComponent<ChoiceController>();
|
||||||
choiceController._option = option;
|
// choiceController._option = option;
|
||||||
return choiceController;
|
// return choiceController;
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void Start()
|
// private void Start()
|
||||||
{
|
// {
|
||||||
if (conversationChangeEvent == null)
|
// if (conversationChangeEvent == null)
|
||||||
conversationChangeEvent = new ConversationChangeEvent();
|
// conversationChangeEvent = new ConversationChangeEvent();
|
||||||
var btn = GetComponent<Button>();
|
// var btn = GetComponent<Button>();
|
||||||
|
|
||||||
var txt = btn.GetComponentInChildren<TextMeshProUGUI>();
|
// var txt = btn.GetComponentInChildren<TextMeshProUGUI>();
|
||||||
txt.text = _option.Description;
|
// txt.text = _option.Description;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void MakeChoice()
|
// public void MakeChoice()
|
||||||
{
|
// {
|
||||||
conversationChangeEvent.Invoke(_option);
|
// conversationChangeEvent.Invoke(_option);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,88 +1,88 @@
|
|||||||
using Assets.Scripts.Actions.Interfaces;
|
//using Assets.Scripts.Actions.Interfaces;
|
||||||
using System.Collections.Generic;
|
//using System.Collections.Generic;
|
||||||
using System.Linq;
|
//using System.Linq;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
//using UnityEngine;
|
||||||
using UnityEngine.UI;
|
//using UnityEngine.UI;
|
||||||
|
|
||||||
public class ConversationController : MonoBehaviour
|
//public class ConversationController : MonoBehaviour
|
||||||
{
|
//{
|
||||||
[SerializeField] public TextMeshProUGUI _title;
|
// [SerializeField] public TextMeshProUGUI _title;
|
||||||
[SerializeField] public Button _choiceButton;
|
// [SerializeField] public Button _choiceButton;
|
||||||
[SerializeField] private Button _btnApply;
|
// [SerializeField] private Button _btnApply;
|
||||||
[SerializeField] private Button _btnClose;
|
// [SerializeField] private Button _btnClose;
|
||||||
|
|
||||||
public ConversationChangeEvent conversationChangeEvent;
|
// public ConversationChangeEvent conversationChangeEvent;
|
||||||
private List<ChoiceController> choiceControllers = new();
|
// private List<ChoiceController> choiceControllers = new();
|
||||||
|
|
||||||
private IPlayerAction _selectedAction = null;
|
// private IPlayerAction _selectedAction = null;
|
||||||
|
|
||||||
private void Awake()
|
// private void Awake()
|
||||||
{
|
// {
|
||||||
Hide();
|
// Hide();
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void Change(string title, List<IPlayerAction> options)
|
// public void Change(string title, List<IPlayerAction> options)
|
||||||
{
|
// {
|
||||||
_btnApply.interactable = false;
|
// _btnApply.interactable = false;
|
||||||
|
|
||||||
_btnClose.onClick.AddListener(() =>
|
// _btnClose.onClick.AddListener(() =>
|
||||||
{
|
// {
|
||||||
Hide();
|
// Hide();
|
||||||
});
|
// });
|
||||||
|
|
||||||
_btnApply.onClick.AddListener(() =>
|
// _btnApply.onClick.AddListener(() =>
|
||||||
{
|
// {
|
||||||
ApplyActionOnPlayer(_selectedAction);
|
// ApplyActionOnPlayer(_selectedAction);
|
||||||
});
|
// });
|
||||||
|
|
||||||
//Player.Instance.allowMovement = false;
|
// //Player.Instance.allowMovement = false;
|
||||||
RemoveChoices();
|
// RemoveChoices();
|
||||||
_title.text = title;
|
// _title.text = title;
|
||||||
gameObject.SetActive(true);
|
// gameObject.SetActive(true);
|
||||||
|
|
||||||
for (var count = 0; count < options.Count; count++)
|
// for (var count = 0; count < options.Count; count++)
|
||||||
{
|
// {
|
||||||
ChoiceController c = ChoiceController.AddChoiceButton(_choiceButton, options.ElementAt(count), count);
|
// ChoiceController c = ChoiceController.AddChoiceButton(_choiceButton, options.ElementAt(count), count);
|
||||||
c.conversationChangeEvent.AddListener(SelectAction);
|
// c.conversationChangeEvent.AddListener(SelectAction);
|
||||||
choiceControllers.Add(c);
|
// choiceControllers.Add(c);
|
||||||
}
|
// }
|
||||||
|
|
||||||
StopAllCoroutines();
|
// StopAllCoroutines();
|
||||||
|
|
||||||
Time.timeScale = 0;
|
// Time.timeScale = 0;
|
||||||
_choiceButton.gameObject.SetActive(false);
|
// _choiceButton.gameObject.SetActive(false);
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void SelectAction(IPlayerAction action)
|
// private void SelectAction(IPlayerAction action)
|
||||||
{
|
// {
|
||||||
_selectedAction = action;
|
// _selectedAction = action;
|
||||||
if (action is ISellable)
|
|
||||||
{
|
|
||||||
// _btnApply.interactable = Player.Instance.Stats[StatsId.Money].Value >= (action as ISellable).Price;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ApplyActionOnPlayer(IPlayerAction action)
|
|
||||||
{
|
|
||||||
// if (action is ISellable)
|
// if (action is ISellable)
|
||||||
// Player.Instance.BuyAction(action);
|
// {
|
||||||
}
|
// // _btnApply.interactable = Player.Instance.Stats[StatsId.Money].Value >= (action as ISellable).Price;
|
||||||
private void RemoveChoices()
|
// }
|
||||||
{
|
// }
|
||||||
foreach (ChoiceController c in choiceControllers)
|
|
||||||
{
|
|
||||||
c.conversationChangeEvent.RemoveAllListeners();
|
|
||||||
Destroy(c.gameObject);
|
|
||||||
}
|
|
||||||
choiceControllers.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Hide()
|
// private void ApplyActionOnPlayer(IPlayerAction action)
|
||||||
{
|
// {
|
||||||
RemoveChoices();
|
// //if (action is ISellable)
|
||||||
gameObject.SetActive(false);
|
// // Player.Instance.BuyAction(action);
|
||||||
Time.timeScale = 1;
|
// }
|
||||||
//Player.Instance.allowMovement = true;
|
// private void RemoveChoices()
|
||||||
}
|
// {
|
||||||
}
|
// foreach (ChoiceController c in choiceControllers)
|
||||||
|
// {
|
||||||
|
// c.conversationChangeEvent.RemoveAllListeners();
|
||||||
|
// Destroy(c.gameObject);
|
||||||
|
// }
|
||||||
|
// choiceControllers.Clear();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public void Hide()
|
||||||
|
// {
|
||||||
|
// RemoveChoices();
|
||||||
|
// gameObject.SetActive(false);
|
||||||
|
// Time.timeScale = 1;
|
||||||
|
// //Player.Instance.allowMovement = true;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|||||||
@@ -1,36 +1,36 @@
|
|||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
//using UnityEngine;
|
||||||
using UnityEngine.UI;
|
//using UnityEngine.UI;
|
||||||
|
|
||||||
public class ItemActionsUI : MonoBehaviour
|
//public class ItemActionsUI : MonoBehaviour
|
||||||
{
|
//{
|
||||||
[SerializeField]
|
// [SerializeField]
|
||||||
private TextMeshProUGUI _title;
|
// private TextMeshProUGUI _title;
|
||||||
[SerializeField]
|
// [SerializeField]
|
||||||
private TextMeshProUGUI _description;
|
// private TextMeshProUGUI _description;
|
||||||
|
|
||||||
[SerializeField]
|
// [SerializeField]
|
||||||
private Button _btnCancel;
|
// private Button _btnCancel;
|
||||||
|
|
||||||
private void Start()
|
// private void Start()
|
||||||
{
|
// {
|
||||||
Hide();
|
// Hide();
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void Show(string title, string description)
|
// public void Show(string title, string description)
|
||||||
{
|
// {
|
||||||
gameObject.SetActive(true);
|
// gameObject.SetActive(true);
|
||||||
_title.text = title;
|
// _title.text = title;
|
||||||
_description.text = description;
|
// _description.text = description;
|
||||||
|
|
||||||
_btnCancel.onClick.AddListener(() =>
|
// _btnCancel.onClick.AddListener(() =>
|
||||||
{
|
// {
|
||||||
Hide();
|
// Hide();
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void Hide()
|
// private void Hide()
|
||||||
{
|
// {
|
||||||
gameObject.SetActive(false);
|
// gameObject.SetActive(false);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -7,12 +8,14 @@ public class Fridge : BaseInteractableObject
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private ContainerSO _containerSO;
|
private ContainerSO _containerSO;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private ItemActionsUI _actionsMenu;
|
//private ItemActionsUI _actionsMenu;
|
||||||
|
|
||||||
|
private Player _player;
|
||||||
private List<FoodItemSO> _foodObjects = new List<FoodItemSO>();
|
private List<FoodItemSO> _foodObjects = new List<FoodItemSO>();
|
||||||
|
|
||||||
public override void Interact(Player player)
|
public override void Interact(Player player)
|
||||||
{
|
{
|
||||||
|
_player = player;
|
||||||
if (player.IsHoldContainerItem())
|
if (player.IsHoldContainerItem())
|
||||||
{
|
{
|
||||||
var playerContainer = player.GetContainerItem();
|
var playerContainer = player.GetContainerItem();
|
||||||
@@ -32,20 +35,26 @@ public class Fridge : BaseInteractableObject
|
|||||||
Debug.Log($"Fridge is full");
|
Debug.Log($"Fridge is full");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//else
|
else
|
||||||
//{
|
{
|
||||||
// //Eat menu
|
//Eat menu
|
||||||
// if (_foodObjects.Count > 0)
|
if (_foodObjects.Count > 0)
|
||||||
// {
|
{
|
||||||
// while (player.Stats[StatsId.Food].Value < player.Stats[StatsId.Food].MaxValue && _foodObjects.Count > 0)
|
var hunger = player.Stats[StatsId.Food].MaxValue - player.Stats[StatsId.Food].Value;
|
||||||
// {
|
var eatingItems = _foodObjects.Count < (hunger / 10) ? _foodObjects.Count : (hunger / 10);
|
||||||
// _foodObjects.RemoveAt(0);
|
StartCoroutine(EatRoutine(eatingItems));
|
||||||
// player.Eat();
|
_foodObjects.RemoveRange(0, (int)eatingItems);
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//_containerSO.CurrentItemsCount = _foodObjects.Count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator EatRoutine(float timeToEat)
|
||||||
|
{
|
||||||
|
_player.SetPlayerActing(PlayerStates.Eating);
|
||||||
|
yield return new WaitForSeconds(timeToEat);
|
||||||
|
_player.SetPlayerActing(PlayerStates.Awake);
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ public class ShopingContainer : BaseInteractableObject
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private ContainerSO _containerSO;
|
private ContainerSO _containerSO;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private ItemActionsUI _actionsMenu;
|
//private ItemActionsUI _actionsMenu;
|
||||||
|
|
||||||
public override void Interact(Player player)
|
public override void Interact(Player player)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ public class Player : MonoBehaviour
|
|||||||
return TaskStatus.InProgress;
|
return TaskStatus.InProgress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsApproximate(Quaternion q1, Quaternion q2, float precision)
|
private bool IsApproximate(Quaternion q1, Quaternion q2, float precision)
|
||||||
{
|
{
|
||||||
return Mathf.Abs(Quaternion.Dot(q1, q2)) >= 1 - precision;
|
return Mathf.Abs(Quaternion.Dot(q1, q2)) >= 1 - precision;
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,6 @@ public class Player : MonoBehaviour
|
|||||||
string stateName = PlayerHelper.GetEnumMemberValue(_currentAnimation);
|
string stateName = PlayerHelper.GetEnumMemberValue(_currentAnimation);
|
||||||
var stateInfo = _animator.GetCurrentAnimatorStateInfo(animLayer);
|
var stateInfo = _animator.GetCurrentAnimatorStateInfo(animLayer);
|
||||||
return stateInfo.IsName(stateName) && stateInfo.normalizedTime < 1.0f;
|
return stateInfo.IsName(stateName) && stateInfo.normalizedTime < 1.0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTask(PlayerTasks task)
|
public void AddTask(PlayerTasks task)
|
||||||
@@ -204,14 +203,18 @@ public class Player : MonoBehaviour
|
|||||||
|
|
||||||
public void UpdateStatsByClock()
|
public void UpdateStatsByClock()
|
||||||
{
|
{
|
||||||
Stats[StatsId.Food].deduct(0.034f); // 48 hours it's 100, 100/2880=~0.034 per minute
|
switch (_currentActing)
|
||||||
if (_currentActing != PlayerStates.Sleeping)
|
|
||||||
{
|
|
||||||
Stats[StatsId.Energy].deduct(0.1f); // 24 hours it's 100, 100/1440=~0.096 per minute
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
case PlayerStates.Eating:
|
||||||
|
Stats[StatsId.Food].increase(10f);
|
||||||
|
break;
|
||||||
|
case PlayerStates.Sleeping:
|
||||||
Stats[StatsId.Energy].increase(0.2f);
|
Stats[StatsId.Energy].increase(0.2f);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Stats[StatsId.Food].deduct(0.034f); // 48 hours it's 100, 100/2880=~0.034 per minute
|
||||||
|
Stats[StatsId.Energy].deduct(0.1f); // 24 hours it's 100, 100/1440=~0.096 per minute
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,13 +222,13 @@ public class Player : MonoBehaviour
|
|||||||
{
|
{
|
||||||
Stats[StatsId.Money].deduct(amount);
|
Stats[StatsId.Money].deduct(amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetContainerItem(ContainerItem containerItem)
|
public void SetContainerItem(ContainerItem containerItem)
|
||||||
{
|
{
|
||||||
containerItem.transform.parent = _holdPoint;
|
containerItem.transform.parent = _holdPoint;
|
||||||
containerItem.transform.localPosition = Vector3.zero;
|
containerItem.transform.localPosition = Vector3.zero;
|
||||||
_containerItem = containerItem;
|
_containerItem = containerItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContainerItem GetContainerItem()
|
public ContainerItem GetContainerItem()
|
||||||
{
|
{
|
||||||
return _containerItem;
|
return _containerItem;
|
||||||
@@ -235,7 +238,6 @@ public class Player : MonoBehaviour
|
|||||||
Destroy(_containerItem.gameObject);
|
Destroy(_containerItem.gameObject);
|
||||||
_containerItem = null;
|
_containerItem = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsHoldContainerItem()
|
public bool IsHoldContainerItem()
|
||||||
{
|
{
|
||||||
return _containerItem != null;
|
return _containerItem != null;
|
||||||
|
|||||||
Reference in New Issue
Block a user