private void SpawnArrows(UpdateState gameState) { float time = gameState.Time; if (time - _arrowSpawnTimer < ArrowSpawnInterval) return; TrackRunner trackRunner = new TrackRunner(_connectionResolver, _junction.NextBranch, false); _arrows.Enqueue(new ArrowController(time, _arrowPrefab, trackRunner)); _arrowSpawnTimer += ArrowSpawnInterval; }
public void Update(MonoBehaviour mono, UpdateState gameState) { if (Input.GetKeyUp(KeyCode.Z)) { _junction.SwitchDirection(); } SpawnArrows(gameState); UpdateArrows(gameState); UpdatePointerDirection(); }
public void Update(MonoBehaviour mono, UpdateState gameState) { if (Input.GetKeyUp(KeyCode.Space)) { _started = true; } if (_started) { _trackFollowingGO.MoveUpdate(1.5f * Time.deltaTime); } }
public void Update(MonoBehaviour mono, UpdateState gameState) { int rotX = 0; int rotY = 0; int rotZ = 0; if (_readyToRot) { rotX = Input.GetKey(KeyCode.S) ? -1 : rotX; rotX = Input.GetKey(KeyCode.W) ? 1 : rotX; rotY = Input.GetKey(KeyCode.A) ? 1 : rotY; rotY = Input.GetKey(KeyCode.D) ? -1 : rotY; rotZ = Input.GetKey(KeyCode.E) ? -1 : rotZ; rotZ = Input.GetKey(KeyCode.Q) ? 1 : rotZ; bool alternate = Input.GetKey(KeyCode.LeftShift); if ((rotX != 0) || (rotY != 0) || (rotZ != 0)) { foreach (SplitSide splitRotation in _splitSides) { int w = rotX != 0 && splitRotation.Axis.Equals(Vector3.right) ? rotX : rotY != 0 && splitRotation.Axis.Equals(Vector3.up) ? rotY : rotZ != 0 && splitRotation.Axis.Equals(Vector3.forward) ? rotZ : 0; if ((w != 0) && (splitRotation.Lhs != alternate)) { TreeRotater.Direction direction = TreeRotater.DirectionFromInt(w); IList<RotationAnimator> animators = _treeRotater.Rotate(splitRotation, direction); _readyToRot = false; _eventRegistry.Notify(new GameEvent(GameEvent.Type.PAUSED)); mono.StartCoroutine(Rotate90Degrees(splitRotation, animators)); //break; } } } } }
private void UpdateArrows(UpdateState gameState) { float time = gameState.Time; bool pop = _arrows.Aggregate(false, (current, arrow) => !arrow.Update(time) || current); if (pop) { _arrows.Peek().Destroy(); _arrows.Dequeue(); } }