Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bošániová Monika
Rubics_cube
Commits
6966a952
Commit
6966a952
authored
Jul 17, 2021
by
Bošániová Monika
Browse files
Small changes
parent
451c69fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Assets/Scripts/Automate.cs
View file @
6966a952
...
...
@@ -9,15 +9,14 @@ public class Automate : MonoBehaviour
private
static
List
<
string
>
moveList
=
new
List
<
string
>()
{
};
private
static
MovesCollection
movelist
=
new
MovesCollection
();
private
static
MovesIterator
movelistIterator
=
new
MovesIterator
(
movelist
);
public
GameObject
rubicsCube
;
public
GameObject
cubeMap
;
public
GameObject
ClickableRotator
;
//static List<string> undoMoveList = new List<string>() { };
public
static
int
actualPosition
=
0
;
public
static
bool
shuffleDone
=
false
;
public
static
bool
AutomatePlaying
=
false
;
//bool automateRotation = false;
//CubeMapMatrix cubeMap;
Colors
side
=
Colors
.
Blue
;
private
GameObject
movingParts
;
...
...
@@ -33,13 +32,12 @@ public class Automate : MonoBehaviour
};
private
CubeState
cubeState
;
//private ReadCube readCube;
// Start is called before the first frame update
void
Start
()
{
cubeState
=
FindObjectOfType
<
CubeState
>();
//cubeMap = CubeMapMatrix.CubeMatrix;
CubeState
.
started
=
true
;
movingParts
=
new
GameObject
();
}
...
...
@@ -130,8 +128,6 @@ public class Automate : MonoBehaviour
public
void
Shuffle
()
{
//dopisat aby sa negenerovali opacne
List
<
string
>
moves
=
new
List
<
string
>();
int
shuffleLength
=
UnityEngine
.
Random
.
Range
(
10
,
30
);
for
(
int
i
=
0
;
i
<
shuffleLength
;
i
++)
...
...
@@ -149,16 +145,7 @@ public class Automate : MonoBehaviour
}
print
(
tmp
);
shuffleDone
=
true
;
//actualPosition = 0;
//ClickableRotator.SetActive(false);
AutomatePlaying
=
true
;
//moveList = new List<string>();
//moveList = new List<string>() { "F'", "L2", "D'", "B", "U'", "F", "U", "L'", "F2", "U'", "R2", "L'", "D2", "D2", "R2", "R", "B'", "L", "F2", "F", "D2", "L'", "U", "R2", "R'", "L'", "B2", "L", "U'", "R'", "R2" };
//moveList = new List<string>() { "F'"};
}
...
...
@@ -260,7 +247,6 @@ public class Automate : MonoBehaviour
// set parent back
foreach
(
Transform
child
in
childsToEdit
)
child
.
SetParent
(
movingParts
.
transform
);
//print(movingParts.transform.childCount + " hehe");
RotateSide
();
}
...
...
@@ -353,6 +339,5 @@ public class Automate : MonoBehaviour
{
movelist
.
AddCollection
(
moves
);
movelistIterator
.
Reset
();
//moveList = moves;
}
}
Assets/Scripts/Iterator.cs
View file @
6966a952
...
...
@@ -18,13 +18,12 @@ abstract class Iterator : IEnumerator
//Move one step back
public
abstract
bool
MoveBack
();
//Return to the start position
public
abstract
void
Reset
();
}
abstract
class
IteratorAggregate
:
IEnumerable
{
// Returns an Iterator or another IteratorAggregate for the implementing
// object.
public
abstract
IEnumerator
GetEnumerator
();
}
...
...
@@ -32,17 +31,12 @@ class MovesIterator : Iterator
{
private
MovesCollection
_collection
;
// Stores the current traversal position. An iterator may have a lot of
// other fields for storing iteration state, especially when it is
// supposed to work with a particular kind of collection.
private
int
_position
=
-
1
;
//private bool _reverse = false;
public
MovesIterator
(
MovesCollection
collection
)
{
this
.
_collection
=
collection
;
//this._reverse = reverse;
}
public
override
object
Current
()
...
...
@@ -91,8 +85,6 @@ class MovesIterator : Iterator
}
}
// Concrete Collections provide one or several methods for retrieving fresh
// iterator instances, compatible with the collection class.
class
MovesCollection
:
IteratorAggregate
{
List
<
string
>
_collection
=
new
List
<
string
>();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment