From d9e0215aae1a492052f2af6626f3f7d0e7e7342c Mon Sep 17 00:00:00 2001 From: Richard Marcus <richard.marcus@fau.de> Date: Wed, 22 Jul 2020 18:19:12 +0200 Subject: [PATCH] added scripts --- Assets/InventoryStuff/Inventory.meta | 8 +++++ Assets/Level.cs | 49 ++++++++++++++++++++++++++++ Assets/Level.cs.meta | 11 +++++++ Assets/StreamingAssets.meta | 8 +++++ 4 files changed, 76 insertions(+) create mode 100644 Assets/InventoryStuff/Inventory.meta create mode 100644 Assets/Level.cs create mode 100644 Assets/Level.cs.meta create mode 100644 Assets/StreamingAssets.meta diff --git a/Assets/InventoryStuff/Inventory.meta b/Assets/InventoryStuff/Inventory.meta new file mode 100644 index 00000000..354d69c1 --- /dev/null +++ b/Assets/InventoryStuff/Inventory.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8c00acf0711308b4eac44fb21f04a06f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Level.cs b/Assets/Level.cs new file mode 100644 index 00000000..bd58a9c7 --- /dev/null +++ b/Assets/Level.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +//TODO: think about having one Level class and then different subclasses like TreeLevel, Tangenslevel? +public class Level : MonoBehaviour +{ + + //Solving game parameters + public GameObject snapZoneTop; + public GameObject snapZoneBottom; + public static Vector3 solutionVector; + public static bool solved = false; + // Start is called before the first frame update + void Start() + { + solutionVector = snapZoneTop.transform.position - snapZoneBottom.transform.position; + } + + + public static bool gameSolved() + { + + Vector3 tempDir1 = new Vector3(0, 0, 0); + Vector3 tempDir2 = new Vector3(0, 0, 0); + + if (solved == true) + return true; + else + { + var Facts = CommunicationEvents.Facts; + //Look for solutionFact in global factList + foreach (Fact fact in Facts) + { + if (typeof(LineFact).IsInstanceOfType(fact)) + { + tempDir1 = ((PointFact)Facts.Find(x => x.Id == ((LineFact)fact).Pid1)).Point - ((PointFact)Facts.Find(x => x.Id == ((LineFact)fact).Pid2)).Point; + tempDir2 = ((PointFact)Facts.Find(x => x.Id == ((LineFact)fact).Pid2)).Point - ((PointFact)Facts.Find(x => x.Id == ((LineFact)fact).Pid1)).Point; + if (solutionVector == tempDir1 || solutionVector == tempDir2) + { + solved = true; + return true; + } + } + } + return false; + } + } +} diff --git a/Assets/Level.cs.meta b/Assets/Level.cs.meta new file mode 100644 index 00000000..0870875b --- /dev/null +++ b/Assets/Level.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ca8bc7e0b1ca4384192fec35c8699cd9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets.meta b/Assets/StreamingAssets.meta new file mode 100644 index 00000000..7a25ae40 --- /dev/null +++ b/Assets/StreamingAssets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 809deaa1d951e5741bce0ace20cdaed8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: -- GitLab