Skip to content
Snippets Groups Projects
Commit 6f4db616 authored by Benjamin Bösl's avatar Benjamin Bösl
Browse files

adapted inventory stuff, to use global fact-management-system (fms)

parent fe9328a8
No related branches found
No related tags found
No related merge requests found
fileFormatVersion: 2
guid: e50bfc6d769196d4e836ba779a6995ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PythagorasScroll : DefaultScroll
{
}
fileFormatVersion: 2
guid: a4568103619d54d43925225cdb10b7ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -4,5 +4,5 @@
public class PointWrapper : MonoBehaviour
{
public PointObject point;
public Fact point;
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerScript : MonoBehaviour
{
public Inventory inventory;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void AddLenghtFact()
{
LengthObject fact = ScriptableObject.CreateInstance<LengthObject>();
fact.pointA = "A";
fact.pointB = "B";
fact.Lenght = 1.0;
fact.Description = "LengthFact";
inventory.AddFact(fact);
}
public void AddAngleFact(){
AngleObject fact = ScriptableObject.CreateInstance<AngleObject>();
fact.pointA = "X";
fact.pointB = "Y";
fact.pointC = "Z";
fact.angle = 90.0;
fact.Description = "AngleFact";
inventory.AddFact(fact);
}
public void AddPointFact(){
PointObject fact = ScriptableObject.CreateInstance<PointObject>();
fact.point = "P";
inventory.AddFact(fact);
}
private void OnApplicationQuit()
{
inventory.Facts.Clear();
for(int i = 0; i < inventory.Scrolls.Count; i++){
inventory.Scrolls[i].isDisplayed = false;
}
}
}
fileFormatVersion: 2
guid: 8deb287bc63461e4b9bfa68c45404328
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- inventory: {fileID: 11400000, guid: f3a619d9c65f61d4b9c7c86923b1ad95, type: 2}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -4,9 +4,9 @@
public class PythagorasScript : MonoBehaviour
{
private Dictionary<string, ItemObject> items = new Dictionary<string, ItemObject>();
private Dictionary<string, Fact> items = new Dictionary<string, Fact>();
public void putItem(string name, ItemObject obj) {
public void putFact(string name, Fact obj) {
if (this.items.ContainsKey(name)) {
this.items.Remove(name);
}
......@@ -14,7 +14,7 @@ public void putItem(string name, ItemObject obj) {
}
public void doMagic() {
Dictionary<string, ItemObject>.Enumerator enumerator = this.items.GetEnumerator();
Dictionary<string, Fact>.Enumerator enumerator = this.items.GetEnumerator();
while (enumerator.MoveNext()){
Debug.Log(enumerator.Current.Key + " is mapped to " + enumerator.Current.Value);
}
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment