/// <summary> /// Puts down the currently held disc on top of the current stack /// </summary> /// <param name="p_currentPoleTopDisc">The top of the current stack on the pole</param> /// <param name="p_pole">The pole where this disc will be placed</param> private void PutDiscOnTopOfStack(HanoiDisc p_currentPoleTopDisc, HanoiPole p_pole) { if (_currentlyHeldDisc) { // Raise the on put down event _onDiscPutdown.Raise(); Vector3 currentDiscPosition = Vector3.zero; if (p_currentPoleTopDisc) // If stack is not empty, get the top of the stack to land on { currentDiscPosition = p_currentPoleTopDisc.transform.position; } else // If stack is empty, get the base of the board { currentDiscPosition = new Vector3(p_pole.transform.position.x, -_currentlyHeldDisc.YScale, p_pole.transform.position.z); } // Calculate Landing Position based on scale currentDiscPosition += Vector3.up * _currentlyHeldDisc.YScale * 2f; // Set position based on calculated position _currentlyHeldDisc.transform.position = currentDiscPosition; _currentlyHeldDisc.transform.SetParent(p_pole.transform); // Update Movecount if you moved to another pole if (p_pole != _currentDiscOriginalPole) { _moveCount.SetVariableValue(_moveCount.Value + 1); } // Add it to the stack p_pole.AddDiscToStack(_currentlyHeldDisc); // Reset the Currently Held disc _currentlyHeldDisc = null; // Raise the disc stack event _onDiscStack.Raise(); } }
private void Start() { // Reset Movec ount on start _moveCount.SetVariableValue(0); }
private void Start() { _discQuantity.SetVariableValue(1); }