public static void GenerateNextSquare() { _isGeneratedForward = true; Enumerators.Direction spawningDir = (Enumerators.Direction)Random.Range(0, 2); var lastSquarePos = _squares[_squares.Count - 1].position; if (spawningDir == Enumerators.Direction.R) { lastSquarePos.GrowX(); } else { lastSquarePos.GrowZ(); } //_squares.Add(new Square( // (GameObject)Object.Instantiate(Square.squarePrefab, Vector3.zero, Quaternion.Euler(90, 0, 0)), // new IntVector2(lastSquarePos.x, lastSquarePos.z), // spawningDir)); var addedSquare = _poolObject[0]; _poolObject.RemoveAt(0); _squares.Add(addedSquare); addedSquare.Appear(); addedSquare.position = lastSquarePos; addedSquare.dir = spawningDir; }
public Square(GameObject go, IntVector2 position, Enumerators.Direction dir) { _dir = dir; _position = position; _instance = go; _instance.transform.position = new Vector3(_position.x * GameManager.spawnDistance, 0, _position.z * GameManager.spawnDistance); _animation = _instance.GetComponent <Animation>(); PlayAnim(Enumerators.SquareAnimType.CREATE); }
public static void MenuStartUpdate() { _backgroundMat.color = EvaluateGrad(); var lastSquarePos = _squares[_jumpCounter].position; _playerDirection = _squares[_jumpCounter].dir; if (_squares[_jumpCounter].dir == Enumerators.Direction.L && Time.time < _nextJumpTime) { _player.transform.parent.position = new Vector3(lastSquarePos.x * _spawnDistance, 0, (((Time.time - _nextJumpTime - _jumpTimeDelay) / _jumpTimeDelay) + (lastSquarePos.z + 1)) * _spawnDistance); if (Time.time > _nextJumpTime - _jumpTimeDelay / _reactionTime && !_isGeneratedForward) { GenerateNextSquare(); } } else if (_squares[_jumpCounter].dir == Enumerators.Direction.R && Time.time < _nextJumpTime) { _player.transform.parent.position = new Vector3((((Time.time - _nextJumpTime - _jumpTimeDelay) / _jumpTimeDelay) + (lastSquarePos.x + 1)) * _spawnDistance, 0, lastSquarePos.z * _spawnDistance); if (Time.time > _nextJumpTime - _jumpTimeDelay / _reactionTime && !_isGeneratedForward) { GenerateNextSquare(); } } else { _isGeneratedForward = false; _nextJumpTime += _jumpTimeDelay; _jumpCounter++; _playerAnimator.Play("Jump", -1, 0f); } if (_squares.Count >= _maxSquaresOnScreen) { _squares[_squares.Count - _maxSquaresOnScreen].Destroy(); _poolObject.Add(_squares[_squares.Count - _maxSquaresOnScreen]); _jumpCounter--; _squares.RemoveAt(_squares.Count - _maxSquaresOnScreen); } }
//Button - Enter Torque private void retroButton7_MouseUp(object sender, MouseEventArgs e) { if (CalibrationSettings.Default.SoundEnabled == true) GlobalFunctions.PlayClickSound(); if (textBoxDuration.Text == "" || Convert.ToDouble(textBoxDuration.Text) <= 0) return; if (Convert.ToDouble(textBoxDuration.Text) > 60) { frmMessageDialog.DisplayBriefMessage("Maximum Duration may not exceed " + CalibrationSettings.Default.MaxAllowableDuration + " Minutes"); SelectedDuration = TimeSpan.FromMinutes(CalibrationSettings.Default.MaxAllowableDuration); textBoxDuration.Text = CalibrationSettings.Default.MaxAllowableDuration.ToString(); return; } else SelectedDuration = TimeSpan.FromMinutes(Convert.ToInt32(textBoxDuration.Text)); DirectionSelector = Enumerators.Direction.Forward; tabControl1.SelectedTab = tabPageStart; tabPageStart.Show(); //tabControl1.SelectedTab = tabPageDirection; //tabPageDirection.Show(); }
private void btnForward_MouseUp(object sender, MouseEventArgs e) { if (CalibrationSettings.Default.SoundEnabled == true) GlobalFunctions.PlayClickSound(); DirectionSelector = Enumerators.Direction.Forward; tabControl1.SelectedTab = tabPageStart; tabPageStart.Show(); }
private static void BaseSetDir(Enumerators.Direction playerDirection) { GameManager.playerDirection = playerDirection; _swipeRegistred = true; }
public void SwitchDirection() { if (FeedbackSpeed >= 0) //Current Speed is forward { SelectedDirection = Enumerators.Direction.Backward; } else //Current Speed is Backward { SelectedDirection = Enumerators.Direction.Forward; } }