private void ClockTickEvent(object source, ElapsedEventArgs e) { if (CamTable.Count == 0) { return; } foreach (var physicalAddress in CamTable.Keys.ToList()) { if (CamTable[physicalAddress].TimeToDie()) { CamTable.TryRemove(physicalAddress, out _); this.Log(new SyslogMessage(Severity.Debug, $"{physicalAddress} expired in CAM")); } } if (CamTable.Count == 0) { this.Log(new SyslogMessage(Severity.Alert, "CAM table is empty")); } CamChange?.Invoke(this, e); }
public void ClearCam() { CamTable.Clear(); CamChange?.Invoke(this, null); this.Log(new SyslogMessage(Severity.Alert, "CAM table have been manually flushed")); }
private void FixedUpdate() { //Debug.Log(CameraToChange); GameObject CameraChange = GameObject.Find("Ball1"); CamChange changeCam = CameraChange.GetComponent <CamChange>(); CameraToChange = CamChange.ChangeCam; //Debug.Log(CameraToChange); if (CameraToChange == 0) { Vector3 desiredPosition = Ball1.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; } if (CameraToChange == 1) { Vector3 desiredPosition = Ball2.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; } if (CameraToChange == 2) { Vector3 desiredPosition = WreckingBall.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; } if (CameraToChange == 3) { Vector3 desiredPosition = Dominos.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; transform.LookAt(Dominos); } if (CameraToChange == 4) { Vector3 desiredPosition = Dominos2.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; transform.LookAt(Dominos2); } if (CameraToChange == 5) { Vector3 desiredPosition = Dominos3.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; transform.LookAt(Dominos3); } if (CameraToChange == 6) { Vector3 desiredPosition = Dominos4.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; transform.LookAt(Dominos4); } if (CameraToChange == 7) { Vector3 desiredPosition = Dominos5.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; transform.LookAt(Dominos5); } if (CameraToChange == 8) { Vector3 desiredPosition = Dominos6.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; } if (CameraToChange == 9) { Vector3 desiredPosition = Dominos6.position + offset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; } if (CameraToChange == 10) { Vector3 desiredPosition = Gun.position + GunOffset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; CurrentYAngle = (gameObject.transform.rotation.eulerAngles.y); //assigns the Z angle to its variable int GunYAngle = (int)CurrentYAngle; transform.Rotate(GunRotationOffset * speed * Time.deltaTime); if (GunYAngle > 240) { speed = 0f; } } if (CameraToChange == 11) { Vector3 desiredPosition = Ramp.position + RampOffset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; } if (CameraToChange == 12) { Vector3 desiredPosition = Hammer.position + HammerOffset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; } if (CameraToChange == 13) { Vector3 desiredPosition = Boot.position + BootOffset; Vector3 smoothedPosition = Vector3.Lerp(transform.position, desiredPosition, smoothSpeed); transform.position = smoothedPosition; } }