public unsafe void UpdateViews(List <Transform> views) { GameState *state = (GameState *)Bindings.memory.ToPointer(); for (int i = 0; i < state->count; i++) { views[i].position = state->bodies[i].pos; } }
public unsafe void Init(int count) { GameState *state = (GameState *)Bindings.memory.ToPointer(); state->count = count; state->adjust = 1f / count; for (int i = 0; i < state->count; i++) { state->bodies[i] = new Body() { pos = UnityEngine.Random.insideUnitCircle * 10f, vel = UnityEngine.Random.insideUnitCircle, acc = Vector2.zero }; } }