コード例 #1
0
        private void RemoveCube(CubeModel cube)
        {
            cube.MarkedForRemoval.Value = true;
            Cubes.Remove(cube);

            //clean up subscriptions
            _disposableSubscriptions[cube].Dispose();
            _disposableSubscriptions.Remove(cube);
        }
コード例 #2
0
        private void CreateCube()
        {
            var cube = new CubeModel();
            var compositeDisposableForThisCube = new CompositeDisposable();

            _disposableSubscriptions[cube] = compositeDisposableForThisCube;

            var subscription = cube.Collisions.Where(coll => coll >= NumberOfBouncesBeforeDeletion).Subscribe(x => RemoveCube(cube))
                               .AddTo(compositeDisposableForThisCube);

            Cubes.Add(cube);
        }