public void SendStack() { //Change direction and add a stack _leftRigth = !_leftRigth; _stackNumber++; activeStackCube = GetStack(); //Calculate and set position of last cube objeDestination = lastStackPosition - outCameraDistance * (_leftRigth ? Vector3.left : Vector3.back); objeDestination.y = _stackNumber; activeStackCube.SetPositionScale(objeDestination, lastStackScale); //Activate last cube activeStackCube.Active(true); //Calculate and set destination of last cube objeDestination = lastStackPosition; objeDestination.y = _stackNumber; activeStackCube.Move(objeDestination, gameSpeed); }
public void Add(StackCube stackCube) { for (int i = 0; i < stackCubePoolNumber; i++) { if (stackCubes[i] == null) { stackCubes[i] = stackCube; stackCube.cubeId = i; break; } } }
public void EmptyAllObjects() { lastStackPosition = new Vector3(0, 0, 0); lastStackScale = new Vector3(5, 1, 5); objeDestination = new Vector3(0, 0, 0); _stackNumber = 0; _leftRigth = true; CleanObjects(); activeStackCubeIndex = 0; activeStackCube = stackCubes[0]; SendStack(); restarting = false; gameFail = false; }
private void Start() { activeStackCubeIndex = 0; activeStackCube = stackCubes[0]; SendStack(); }