Commit 9ca95935 authored by Bošániová Monika's avatar Bošániová Monika
Browse files

Delete unnecessary files

parent 37a16e64
......@@ -134,36 +134,7 @@ public class CubeMap : MonoBehaviour
}
//int i = 0;
//foreach(Transform map in side)
//{
// if(face[i].name[0] == 'F')
// {
// map.GetComponent<Image>().color = Color.blue;
// }
// if (face[i].name[0] == 'B')
// {
// map.GetComponent<Image>().color = Color.green;
// }
// if (face[i].name[0] == 'U')
// {
// map.GetComponent<Image>().color = Color.white;
// }
// if (face[i].name[0] == 'D')
// {
// map.GetComponent<Image>().color = Color.yellow;
// }
// if (face[i].name[0] == 'L')
// {
// map.GetComponent<Image>().color = Color.red;
// }
// if (face[i].name[0] == 'R')
// {
// map.GetComponent<Image>().color = new Color(1, 0.5f, 0, 1);
// }
// i++;
//}
}
......
This diff is collapsed.
fileFormatVersion: 2
guid: 8f337c563577668468743bb537a215fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -6,13 +6,7 @@ using UnityEngine.UI;
public class CubeState : MonoBehaviour
{
//sides
//public List<GameObject> front = new List<GameObject>();
//public List<GameObject> back = new List<GameObject>();
//public List<GameObject> up = new List<GameObject>();
//public List<GameObject> down = new List<GameObject>();
//public List<GameObject> left = new List<GameObject>();
//public List<GameObject> right = new List<GameObject>();
public GameObject cubemap;
......@@ -31,44 +25,7 @@ public class CubeState : MonoBehaviour
}
public void PickUp(List<GameObject> cubeSide)
{
foreach (GameObject face in cubeSide)
{
//Attack the parent of each face (the little cube)
// to the parent of the 4th index (the little cube in the middle)
// unless it is already the 4th index
if (face != cubeSide[4])
{
face.transform.parent.transform.parent = cubeSide[4].transform.parent;
}
}
}
public void PutDown(List<GameObject> littleCubes, Transform pivot)
{
foreach(GameObject littleCube in littleCubes)
{
if(littleCube != littleCubes[4])
{
littleCube.transform.parent.transform.parent = pivot;
}
}
}
//string GetSideString(List<GameObject> side)
//{
// string sideString = "";
// foreach (GameObject face in side)
// {
// sideString += face.name[0].ToString();
// }
// return sideString;
//}
public string GetStateString(bool isKociemba)
{
......@@ -162,12 +119,6 @@ public class CubeState : MonoBehaviour
}
}
//stateString += GetSideString(up);
//stateString += GetSideString(left);
//stateString += GetSideString(front);
//stateString += GetSideString(right);
//stateString += GetSideString(back);
//stateString += GetSideString(down);
return string.Join("", stateString);
......
......@@ -9,24 +9,4 @@ public class Face
public char[] row2 = new char[3];
public char[] row3 = new char[3];
//Row[] rows;
//public Face(Colors color)
//{
// rows = new Row[numOfRows];
// for (int i = 0; i < numOfRows; i++)
// {
// rows[i] = (new Row(color));
// }
// //this.row1 = new Row(color);
// //this.row2 = new Row(color);
// //this.row3 = new Row(color);
//}
//public Row getRow(int row)
//{
// return rows[row];
//}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PivotRotation : MonoBehaviour
{
private List<GameObject> activeSide;
private Vector3 localForward;
private Vector3 mouseRef;
private bool dragging = false;
private bool autoRotating = false;
private float sensitivity = 0.4f;
private float speed = 300f;
private Vector3 rotation;
private Quaternion targetQuaternion;
//private ReadCube readCube;
private CubeState cubeState;
// Start is called before the first frame update
void Start()
{
//readCube = FindObjectOfType<ReadCube>();
cubeState = FindObjectOfType<CubeState>();
}
// Late Update is called once per frame at the end
void LateUpdate()
{
//print("Pivot?" + dragging + autoRotating);
//if (dragging && !autoRotating)
//{
// SpinSide(activeSide);
// if (Input.GetMouseButtonUp(0))
// {
// dragging = false;
// RotateToRightAngle();
// }
//}
if (autoRotating)
{
AutoRotate();
}
}
//private void SpinSide(List<GameObject> side)
//{
// // reset the rotation
// rotation = Vector3.zero;
// //current move position minus the last mouse position
// Vector3 mouseOffset = (Input.mousePosition - mouseRef);
// if (side == cubeState.front)
// {
// rotation.x = (mouseOffset.x + mouseOffset.y) * -sensitivity;
// }
// if (side == cubeState.back)
// {
// rotation.x = (mouseOffset.x + mouseOffset.y) * sensitivity;
// }
// if (side == cubeState.up)
// {
// rotation.y = (mouseOffset.x + mouseOffset.y) * sensitivity;
// }
// if (side == cubeState.down)
// {
// rotation.y = (mouseOffset.x + mouseOffset.y) * -sensitivity;
// }
// if (side == cubeState.left)
// {
// rotation.z = (mouseOffset.x + mouseOffset.y) * sensitivity;
// }
// if (side == cubeState.right)
// {
// rotation.z = (mouseOffset.x + mouseOffset.y) * -sensitivity;
// }
// //rotate
// transform.Rotate(rotation, Space.Self);
// // store mouse
// mouseRef = Input.mousePosition;
//}
public void Rotate(List<GameObject> side)
{
activeSide = side;
mouseRef = Input.mousePosition;
dragging = true;
//Create a vector to rotate around
localForward = Vector3.zero - side[4].transform.parent.transform.localPosition;
}
public void StartAutoRotate(GameObject centre, float angle)
{
//cubeState.PickUp(side);
Vector3 localForward = Vector3.zero - centre.transform.parent.transform.localPosition;
targetQuaternion = Quaternion.AngleAxis(angle, localForward) * transform.localRotation;
//activeSide = side;
autoRotating = true;
}
public void RotateToRightAngle()
{
Vector3 vec = transform.localEulerAngles;
// round vec to nearest 90 degrees
vec.x = Mathf.Round(vec.x / 90) * 90;
vec.y = Mathf.Round(vec.y / 90) * 90;
vec.z = Mathf.Round(vec.z / 90) * 90;
targetQuaternion.eulerAngles = vec;
autoRotating = true;
}
private void AutoRotate()
{
dragging = false;
var step = speed * Time.deltaTime;
transform.localRotation = Quaternion.RotateTowards(transform.localRotation, targetQuaternion, step);
//if within one degree, set angle to target angle and end the rotation
if (Quaternion.Angle(transform.localRotation, targetQuaternion) <= 1)
{
transform.localRotation = targetQuaternion;
//unparent the little cubes
cubeState.PutDown(activeSide, transform.parent);
//readCube.ReadState();
CubeState.autoRotating = false;
autoRotating = false;
dragging = false;
}
}
}
fileFormatVersion: 2
guid: 784255472eb26bb4eb8b3b5e83ffe3ac
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ReadCube : MonoBehaviour
{
public Transform tUp;
public Transform tDown;
public Transform tLeft;
public Transform tRight;
public Transform tFront;
public Transform tBack;
private List<GameObject> frontRays = new List<GameObject>();
private List<GameObject> backRays = new List<GameObject>();
private List<GameObject> upRays = new List<GameObject>();
private List<GameObject> downRays = new List<GameObject>();
private List<GameObject> leftRays = new List<GameObject>();
private List<GameObject> rightRays = new List<GameObject>();
private int layerMask = 1 << 8; // this layerMask is for the faces of the cube only
CubeState cubeState;
CubeMap cubeMap;
public GameObject emptyGO;
//CubeMapMatrix cubeMapMatrix;
// Start is called before the first frame update
void Start()
{
//SetRayTransforms();
cubeState = FindObjectOfType<CubeState>();
cubeMap = FindObjectOfType<CubeMap>();
ReadState();
CubeState.started = true;
}
// Update is called once per frame
void Update()
{
}
public void ReadState()
{
cubeState = FindObjectOfType<CubeState>();
cubeMap = FindObjectOfType<CubeMap>();
//set the state of each position in the list of sides so we know
//what color is in what position
//cubeState.up = ReadFace("up");
//cubeState.down = ReadFace("down");
//cubeState.left = ReadFace("left");
//cubeState.right = ReadFace(rightRays, tRight);
//cubeState.front = ReadFace(frontRays, tFront);
//cubeState.back = ReadFace(backRays, tBack);
//update the map with the found positions
cubeMap.Set();
}
//void SetRayTransforms()
//{
// // populate the ray lists with raycasts eminating from the transform, angles towards the cube.
// upRays = BuildRays(tUp, new Vector3(90, 90, 0));
// downRays = BuildRays(tDown, new Vector3(270, 90, 0));
// leftRays = BuildRays(tLeft, new Vector3(0, 180, 0));
// rightRays = BuildRays(tRight, new Vector3(0, 0, 0));
// frontRays = BuildRays(tFront, new Vector3(0, 90, 0));
// backRays = BuildRays(tBack, new Vector3(0, 270, 0));
//}
//List<GameObject> BuildRays(Transform rayTransform, Vector3 direction)
//{
// // The ray count is used to name the rays so we can be sure they are in the right order.
// int rayCount = 0;
// List<GameObject> rays = new List<GameObject>();
// // This creates 9 rays in the shape of the cube with
// // Ray 0 at the top left and Ray 8 at the bottom right:
// // |0|1|2|
// // |3|4|5|
// // |6|7|8|
// for (int y = 1; y > -2; y--)
// {
// for (int x = -1; x < 2; x++)
// {
// Vector3 startPos = new Vector3(rayTransform.localPosition.x + x,
// rayTransform.localPosition.y + y,
// rayTransform.localPosition.z);
// GameObject rayStart = Instantiate(emptyGO, startPos, Quaternion.identity, rayTransform);
// rayStart.name = rayCount.ToString();
// rays.Add(rayStart);
// rayCount++;
// }
// }
// rayTransform.localRotation = Quaternion.Euler(direction);
// return rays;
//}
public List<GameObject> ReadFace(List<GameObject> rayStarts, Transform rayTransform)
{
List<GameObject> facesHit = new List<GameObject>();
//GameObject.FindGameObjectsWithTag;
//foreach (GameObject rayStart in rayStarts)
//{
// Vector3 ray = rayStart.transform.position;
// RaycastHit hit;
// //Does the ray intersect any objects int the layerMask?
// if (Physics.Raycast(ray, rayTransform.forward, out hit, Mathf.Infinity, layerMask))
// {
// Debug.DrawRay(ray, rayTransform.forward * hit.distance, Color.yellow);
// facesHit.Add(hit.collider.gameObject);
// //print(hit.collider.gameObject.name);
// }
// else
// {
// Debug.DrawRay(ray, rayTransform.forward * 1000, Color.green);
// }
//}
return facesHit;
}
}
fileFormatVersion: 2
guid: 45dccae675fdd9e489af5b2d6c07c4c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateBigCube : MonoBehaviour
{
//Vector2 firstPressPos; //first position
//Vector2 secondPressPos; //second position
//Vector2 currentSwipe; //direction
//Vector3 previousMousePosition;
//Vector3 mouseDelta;
//public GameObject target;
//private float speed = 200f;
//// Start is called before the first frame update
//void Start()
//{
//}
//// Update is called once per frame
//void Update()
//{
// Swipe();
// Drag();
//}
//void Drag()
//{
// if (Input.GetMouseButton(1))
// {
// //while the mouse is held down the cube can be moved around its central axis
// // to provide visual feedback
// mouseDelta = Input.mousePosition - previousMousePosition;
// mouseDelta *= 0.1f; // reduction of rotation speed
// transform.rotation = Quaternion.Euler(mouseDelta.y, -mouseDelta.x, 0) * transform.rotation;
// }
// else
// {
// //automatically move to the target position
// if (transform.rotation != target.transform.rotation)
// {
// var step = speed * Time.deltaTime;
// transform.rotation = Quaternion.RotateTowards(transform.rotation, target.transform.rotation, step);
// }
// }
// previousMousePosition = Input.mousePosition;
//}
//void Swipe()
//{
// if (Input.GetMouseButtonDown(1))
// {
// //get the 2D position of the first mouse click
// firstPressPos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
// }
// if (Input.GetMouseButtonUp(1))
// {
// //get the 2D position of the second mouse click
// secondPressPos = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
// //create a vector from the first and second click position
// currentSwipe = new Vector2(secondPressPos.x - firstPressPos.x, secondPressPos.y - firstPressPos.y);
// //normalize the 2D vector
// currentSwipe.Normalize();
// if (LeftSwipe(currentSwipe))
// {
// target.transform.Rotate(0, 90, 0, Space.World);
// }
// else if (RightSwipe(currentSwipe))
// {
// target.transform.Rotate(0, -90, 0, Space.World);
// }
// else if (UpLeftSwipe(currentSwipe))
// {
// target.transform.Rotate(90, 0, 0, Space.World);
// }
// else if (UpRightSwipe(currentSwipe))
// {
// target.transform.Rotate(0, 0, -90, Space.World);
// }
// else if (DownLeftSwipe(currentSwipe))
// {
// target.transform.Rotate(0, 0, 90, Space.World);
// }
// else if (DownRightSwipe(currentSwipe))
// {
// target.transform.Rotate(-90, 0, 0, Space.World);
// }
// }
//}
//bool LeftSwipe(Vector2 swipe)
//{
// return swipe.x < 0 && swipe.y > -0.5f && swipe.y < 0.5f;
//}
//bool RightSwipe(Vector2 swipe)
//{
// return swipe.x > 0 && swipe.y > -0.5f && swipe.y < 0.5f;
//}
//bool UpLeftSwipe(Vector2 swipe)
//{
// return swipe.y > 0 && swipe.x < 0f;
//}
//bool UpRightSwipe(Vector2 swipe)
//{
// return swipe.y > 0 && swipe.x > 0f;
//}
//bool DownLeftSwipe(Vector2 swipe)
//{
// return swipe.y < 0 && swipe.x < 0f;
//}
//bool DownRightSwipe(Vector2 swipe)
//{
// return swipe.y < 0 && swipe.x > 0f;
//}
}
fileFormatVersion: 2
guid: d1d3fc671df0d774d85ad9a0e076d039
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SelectFace : MonoBehaviour
{
CubeState cubeState;
//ReadCube readCube;
int layerMask = 1 << 8;
// Start is called before the first frame update
void Start()
{
//readCube = FindObjectOfType<ReadCube>();
cubeState = FindObjectOfType<CubeState>();
}
// Update is called once per frame
void Update()
{
//print("Select:" + Input.GetMouseButtonDown(0) + CubeState.autoRotating + "1");
//if (Input.GetMouseButtonDown(0) && !CubeState.autoRotating)
//{
// // read the current state of the cube
// //readCube.ReadState();
// // reycast from the mouse towards the cube to see if a face is hit
// RaycastHit hit;
// Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
// print("2");