public void sendExternalHeadingUpdate(HeadingData headingData, TimeUpdate timestamp) { msclPINVOKE.InertialNode_sendExternalHeadingUpdate__SWIG_1(swigCPtr, HeadingData.getCPtr(headingData), TimeUpdate.getCPtr(timestamp)); if (msclPINVOKE.SWIGPendingException.Pending) { throw msclPINVOKE.SWIGPendingException.Retrieve(); } }
private void OnHeadingChanged() { if (_lastUpdate.AddMilliseconds(_compass.MinimumTime) >= DateTime.UtcNow) { return; } _lastUpdate = DateTime.UtcNow; var heading = (_orientation[0] * (180.0f / Math.PI) + 360) % 360; var data = new HeadingData(heading + (_geoField?.Declination ?? 0), heading); if (Math.Abs(data.TrueHeading - _currentHeading.TrueHeading) < .001) { return; } _currentHeading = data; _compass.OnHeadingUpdated(_currentHeading); }
private void InstantiatePeople(ref Rooms apartment) { var people = manager.Instantiate(person, person_count, Allocator.Temp); var seed = new System.Random(); for (int i = 0; i < person_count; i++) { Entity p = people[i]; Spawn spawn = GetSpawnPoint(); Vector3 pos = new Vector3( spawn.pos.x, 2.15f, spawn.pos.y); Translation R = new Translation(); R.Value = pos; manager.AddComponentData(p, R); float virus = 0f; bool infected = false; int house_idx = -1; while (house_idx < 0) { house_idx = Random.Range(0, apartment.max_room_idx); if (apartment.space[house_idx] == 0) { house_idx = -1; } else { apartment.space[house_idx] -= 1; } } bool is_nightowl = Random.Range(0f, 1f) < 0.25f; PersonData person_data = new PersonData() { virus = virus, infected = infected, antibodies = 0f, resistence = false, home_coordinates = apartment.coordinates[house_idx], home_idx = house_idx, is_home = false, schedule_phase = (is_nightowl ? 0 : 1) + Random.Range(-0.25f, 0.25f) }; manager.AddComponentData(p, person_data); HeadingData heading_data = new HeadingData() { speed = person_speed + Random.Range(-person_speed_spread, person_speed_spread), direction = spawn.dir, goal_coordinate = apartment.coordinates[house_idx], next_cross_margin = Random.Range(1f, 6f), rng = new Unity.Mathematics.Random((uint)seed.Next()) }; manager.AddComponentData(p, heading_data); URPMaterialPropertyBaseColor color = new URPMaterialPropertyBaseColor() { Value = new float4(1f, 1f, 1f, 1f) }; manager.AddComponentData(p, color); } people.Dispose(); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(HeadingData obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
private void OnHeadingUpdated(HeadingData data) { HeadingUpdated?.Invoke(this, new HeadingEventArgs(data)); }