Пример #1
0
	public void PlaceSizedObjectOnObject(GrabbableSizedObject sizedObject, GrabbableSizedObject belowObject)
	{
		if (!sizedAndPlacedObjects.Contains(belowObject)) {
			sizedAndPlacedObjects.Add(belowObject);
			Debug.Log("Add sizedPlacedObj: "+belowObject);
		}
		sizedAndPlacedObjects.Add(sizedObject);

		// When an object is placed, check if the puzzle is solved
		bool isSolved = false;
		if (sizedAndPlacedObjects.Count == allSizedObjects.Count && sizedAndPlacedObjects.Count > 1) {
			isSolved = true; // Flipped for the for loop
		    if (sizedAndPlacedObjects[0] != null)
		    {
		        int previousSize = sizedAndPlacedObjects[0].size;
		        for (int i = 1; i < sizedAndPlacedObjects.Count; i++)
		        {
		            GrabbableSizedObject nextObject = sizedAndPlacedObjects[i];
		            if (nextObject.size > previousSize)
		            {
		                isSolved = false;
		                break;
		            }
		            previousSize = nextObject.size;
		        }
		    }
		}

		if (isSolved) {
			Debug.Log("OrganizeBySizePuzzle is solved");
			base.CompletePuzzle();
		}
	}
Пример #2
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
    {
        if (objectToInteractWith && objectToInteractWith != transform)
        {
            objectBelow = objectToInteractWith.GetComponent <GrabbableSizedObject>();

            if (objectBelow)
            {
                dropPosition = objectBelow.transform.position;
            }
        }
        else
        {
            Debug.Log("objectBelow is null");
            objectBelow = null;
        }

        return(base.OffInteract(pointer, objectToInteractWith));
    }
Пример #3
0
    public override bool OffInteract(GazePointer pointer, Transform objectToInteractWith)
	{
		if (objectToInteractWith && objectToInteractWith != transform)
		{
			objectBelow = objectToInteractWith.GetComponent<GrabbableSizedObject>();

			if (objectBelow)
			{
				dropPosition = objectBelow.transform.position;
			}
		}
		else
		{
			Debug.Log("objectBelow is null");
			objectBelow = null;
		}
		
		return base.OffInteract(pointer, objectToInteractWith);
	}
Пример #4
0
    public void PlaceSizedObjectOnObject(GrabbableSizedObject sizedObject, GrabbableSizedObject belowObject)
    {
        if (!sizedAndPlacedObjects.Contains(belowObject))
        {
            sizedAndPlacedObjects.Add(belowObject);
            Debug.Log("Add sizedPlacedObj: " + belowObject);
        }
        sizedAndPlacedObjects.Add(sizedObject);

        // When an object is placed, check if the puzzle is solved
        bool isSolved = false;

        if (sizedAndPlacedObjects.Count == allSizedObjects.Count && sizedAndPlacedObjects.Count > 1)
        {
            isSolved = true;             // Flipped for the for loop
            if (sizedAndPlacedObjects[0] != null)
            {
                int previousSize = sizedAndPlacedObjects[0].size;
                for (int i = 1; i < sizedAndPlacedObjects.Count; i++)
                {
                    GrabbableSizedObject nextObject = sizedAndPlacedObjects[i];
                    if (nextObject.size > previousSize)
                    {
                        isSolved = false;
                        break;
                    }
                    previousSize = nextObject.size;
                }
            }
        }

        if (isSolved)
        {
            Debug.Log("OrganizeBySizePuzzle is solved");
            base.CompletePuzzle();
        }
    }
Пример #5
0
 public void UnplaceSizedObject(GrabbableSizedObject sizedObject)
 {
     sizedAndPlacedObjects.Remove(sizedObject);
 }
Пример #6
0
 public void AddSizedObject(GrabbableSizedObject sizedObject)
 {
     allSizedObjects.Add(sizedObject);
 }
Пример #7
0
	public void UnplaceSizedObject(GrabbableSizedObject sizedObject) 
	{
		sizedAndPlacedObjects.Remove(sizedObject);
	}
Пример #8
0
	public void AddSizedObject(GrabbableSizedObject sizedObject) 
	{
		allSizedObjects.Add(sizedObject);
	}