Skip to content
Snippets Groups Projects
Commit d9e0215a authored by Richard Marcus's avatar Richard Marcus
Browse files

added scripts

parent 89b5b014
Branches
Tags
No related merge requests found
fileFormatVersion: 2
guid: 8c00acf0711308b4eac44fb21f04a06f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
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;
}
}
}
fileFormatVersion: 2
guid: ca8bc7e0b1ca4384192fec35c8699cd9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 809deaa1d951e5741bce0ace20cdaed8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment