Dispose() public method

public Dispose ( ) : void
return void
コード例 #1
0
        /// <summary>
        /// This method destrois the scene
        /// </summary>
        protected override void DestroyScene()
        {
            //manObjExample.Dispose();
            base.DestroyScene();
            #region Basics
            if (robot != null)
            {
                robot.Dispose();
            }
            if (environment != null)
            {
                environment.Dispose();
            }
            if (playerModel != null)
            {
                playerModel.Dispose();
            }
            #endregion

            #region Part 6
            //cameraNode.DetachAllObjects();
            //cameraNode.Dispose();
            #endregion

            #region Part 9
            gameHMD.Dispose();
            #endregion

            foreach (Bomb bomb in bombs)
            {
                bomb.Dispose();
            }

            physics.Dispose();
        }
コード例 #2
0
        public async ValueTask DisposeAsync()
        {
            try
            {
                _tokenSource.Cancel();
                await Task.WhenAll(_tasks);

                await _robot.Motors.StopAllMotors();
            }
            catch
            {
                _robot.Dispose();
                _tokenSource.Dispose();
            }
        }
コード例 #3
0
        public async Task DisconnectAsync()
        {
            if (Robot != null && Robot.IsConnected)
            {
                Connection          = ConnectedState.Disconnecting;
                Robot.Disconnected -= OnDisconnect;
                await UnregisterBehavioursAsync(Behaviours);

                if (Robot.IsConnected)
                {
                    await Robot.Disconnect();
                }
                Robot.Dispose();
                Robot      = null;
                Connection = ConnectedState.Disconnected;
            }
        }