protected void Update() { if (Input.GetKeyDown(KeyCode.Space) && this._canInteract) { _canInteract = false; Color c = _spacebar.color; c.a = 0.4f; _spacebar.color = c; if (_setPoliceOnPoint) { SetTensionState(GetNextNaturalTensionState(TensionState)); } else { _setPoliceOnPoint = true; } if (_indexShow <= _crowdsCanvasGroups.Count - 1) { _crowdsCanvasGroups[this._indexShow].alpha = 1; _crowdsCanvasGroups[this._indexShow].transform.localScale = new Vector3(0, 0, 0); _crowdsCanvasGroups[this._indexShow].transform.DOScale(1, 1f).SetEase(Ease.OutBounce); _indexShow++; } } _timeSinceInteraction += Time.deltaTime; if (TensionState != TensionState.Idle) { if ((TensionState == TensionState.Pushy && _policeSpawned.Count < 3) || (TensionState == TensionState.Aggression && _policeSpawned.Count < 5) || (TensionState == TensionState.Outbreak && _policeSpawned.Count < 8)) { SpawnPolice(); } } if (_timeSinceInteraction > 4 + UnityEngine.Random.value * 4) { _timeSinceInteraction = 0; Vector2 interactionLocation = ((RectTransform)transform).anchoredPosition; interactionLocation.x -= 30; interactionLocation.x += 60 * UnityEngine.Random.value; interactionLocation.y -= 60; interactionLocation.y += 120 * UnityEngine.Random.value; switch (TensionState) { case TensionState.Aggression: _interactionSystem.TryInteractionMatch(InteractionSystem.InteractionType.Fighting, interactionLocation); break; case TensionState.Idle: // DO NOTHING break; case TensionState.Pushy: _interactionSystem.TryInteractionMatch(InteractionSystem.InteractionType.Pushing, interactionLocation); break; case TensionState.Outbreak: _interactionSystem.TryInteractionMatch(InteractionSystem.InteractionType.Murder, interactionLocation); break; } } }