monolith burger door have trigger to open a menu

This commit is contained in:
Vladimir Koshevarov
2022-08-18 14:31:33 +03:00
parent 80df6bde42
commit a9e1db4ac2
3 changed files with 36 additions and 16 deletions
+13 -9
View File
@@ -6,25 +6,29 @@ namespace Assets.Scripts.Buildings
{ {
public abstract class BaseCell : MonoBehaviour public abstract class BaseCell : MonoBehaviour
{ {
public Dictionary<string, BaseAction> OptionsList; protected string _name;
protected Dictionary<string, BaseAction> _optionsList;
protected BaseCell()
{
OptionsList = new Dictionary<string, BaseAction>();
}
protected abstract void BuildOptionsList();
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
_optionsList = new Dictionary<string, BaseAction>();
Initialize();
BuildOptionsList();
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
}
protected abstract void Initialize();
protected abstract void BuildOptionsList();
void OnTriggerEnter(Collider other)
{
ConversationController.Instance.Change(_name, _optionsList);
} }
} }
} }
+17 -6
View File
@@ -1,17 +1,28 @@
using Assets.Scripts.Actions; using Assets.Scripts.Actions;
using UnityEngine;
namespace Assets.Scripts.Buildings namespace Assets.Scripts.Buildings
{ {
public class Burger : BaseCell public class Burger : BaseCell
{ {
protected override void Initialize()
{
_name = "Monolith burger";
}
protected override void BuildOptionsList() protected override void BuildOptionsList()
{ {
OptionsList.Add("Hamburgers - 83$", new Eat(null, 6, 1, 83)); _optionsList.Add("Hamburgers - 83$", new Eat(null, 6, 1, 83));
OptionsList.Add("Cheesburger - 94$", new Eat(null, 6, 1, 94)); _optionsList.Add("Cheesburger - 94$", new Eat(null, 6, 1, 94));
OptionsList.Add("Astro chicken - 131$", new Eat(null, 6, 1, 131)); _optionsList.Add("Astro chicken - 131$", new Eat(null, 6, 1, 131));
OptionsList.Add("Fries - 68$", new Eat(null, 6, 1, 68)); _optionsList.Add("Fries - 68$", new Eat(null, 6, 1, 68));
OptionsList.Add("Shakes - 108$", new Eat(null, 6, 1, 108)); _optionsList.Add("Shakes - 108$", new Eat(null, 6, 1, 108));
OptionsList.Add("Colas - 73$", new Eat(null, 6, 1, 73)); _optionsList.Add("Colas - 73$", new Eat(null, 6, 1, 73));
}
void OnTriggerEnter(Collider other)
{
ConversationController.Instance.Change(_name, _optionsList);
} }
} }
} }
+6 -1
View File
@@ -6,7 +6,12 @@ namespace Assets.Scripts.Buildings
{ {
protected override void BuildOptionsList() protected override void BuildOptionsList()
{ {
OptionsList.Add("Rest", new Relax(null, 6, 1)); _optionsList.Add("Rest", new Relax(null, 6, 1));
}
protected override void Initialize()
{
throw new System.NotImplementedException();
} }
} }
} }