private void OnServerWelcome(int id) { _currentId = id; _pewzor = _stuffFactory.CreatePewCircle( new PewCircleSettings { Id = _currentId, Name = "X" + id, SpawnPoint = new PointF(100, 100) }, true); lock (objectsSynchro) { _objects.Add(_pewzor); } }
internal void GoGoLazer(PewCircle pewCircle) { PointF mouse = _inputManager.GetMousePosition().ToPointF(); int newId = Interlocked.Increment(ref _currentId); LazerPewPew lazer = _stuffFactory .CreateLazer(new LazerPewPewSettings { Id = newId, CreatorId = pewCircle.Id, Direction = mouse.Subtract(pewCircle.Physics.Center), SpawnPoint = pewCircle.Physics.GetDirectionAsPoint(15).Add(pewCircle.Physics.Center) }); lock (objectsSynchro) { _objects.Add(lazer); } }