コード例 #1
0
        public async Task <IActionResult> GetChairState([FromBody] ChairRequest value)
        {
            ChairState result = BUS_Controls.Controls.GetChairState(value);

            if (result != null)
            {
                return(new JsonResult(new ApiResponse <object>(result)));
            }
            return(new JsonResult(new ApiResponse <object>(200, "Get Chair State Failed")));
        }
コード例 #2
0
 public void PullChair()
 {
     // chair can be pulled out from under the table only if it's pushed under it,
     // if it's pulled out already or resting on table there is no sense to continue
     // this method
     if (State != ChairState.PushedUnderTable)
     {
         return;
     }
     State = ChairState.PulledOut;
 }
コード例 #3
0
ファイル: ConvertibleChair.cs プロジェクト: tormibg/SoftUni-1
 public void Convert()
 {
     if (this.IsConverted)
     {
         this.state = ChairState.Normal;
         this.Height = this.normalChairHeight;
     }
     else
     {
         this.state = ChairState.Converted;
         this.normalChairHeight = this.Height;
         this.Height = ConvertedStateHeight;
     }
 }
コード例 #4
0
    /// <summary>
    /// Starts animation of ascending the chair into the cockpit to start.
    /// Loops the chair so that the tube feels endless until a connection has been established.
    /// </summary>
    private IEnumerator AscendChair()
    {
        while (_currentChairState != ChairState.Stopped)
        {
            if (Vector3.Distance(ActiveChair.position, _chairEndPosition.position) < _chairDeaccelerationDistance && _currentChairState != ChairState.Stopped)
            {
                _currentChairState = ChairState.Deaccelerating;
            }

            if (_currentChairState == ChairState.Accelerating)
            {
                _currentChairSpeed = Mathf.Lerp(_currentChairSpeed, _chairMaxSpeed, _accelTimer += _chairAcceleration * Time.deltaTime);
                if (_currentChairSpeed >= _chairMaxSpeed)
                {
                    _currentChairSpeed = _chairMaxSpeed;
                    _currentChairState = ChairState.Moving;
                }
            }
            else if (_currentChairState == ChairState.Deaccelerating)
            {
                _currentChairSpeed = _chairMaxSpeed - _chairMaxSpeed * (_chairDeaccelerationDistance - Vector3.Distance(ActiveChair.position, _chairEndPosition.position)) / _chairDeaccelerationDistance;
            }

            ActiveChair.Translate(Vector3.up * _currentChairSpeed * Time.deltaTime);

            if (Vector3.Distance(ActiveChair.position, _loopEndPosition.position) < 1f)
            {
                if (_isLooping)
                {
                    LoopChair();
                }
                else
                {
                    _shaftLid.gameObject.SetActive(false);
                }
            }
            if (Vector3.Distance(ActiveChair.position, _chairEndPosition.position) < 0.1f)
            {
                _currentChairState = ChairState.Stopped;
                foreach (Light light in _shaftLights)
                {
                    light.enabled = false;
                }
                StartCoroutine(StartUpSequence());
            }
            ManageShaftLights();
            yield return(new WaitForEndOfFrame());
        }
    }
コード例 #5
0
    /// <summary>
    /// Connects to USB 360 camera and starts up animations
    /// </summary>
    public void ConnectToRobot()
    {
        if (FeedbackFromCamera)
        {
            _cameraStreamUSB.StartStream();
        }
        else
        {
        }

        _currentChairState = ChairState.Accelerating;
        StartCoroutine(AscendChair());

        //connect to the appropriate controller
        if (VirtualEnvironment)
        {
            VirtualUnityController.Instance.Connect();
        }
        else
        {
            RobotInterface.Instance.Connect();
        }

        //what about older projects?
        if (_queryManager)
        {
            _queryManager.EnableManager();
        }

        if (GazeTrackingDataManager.Instance)
        {
            GazeTrackingDataManager.Instance.EnableManager();
        }

        //TODO: When online connection is put in, uncomment this
        //_isLooping = true;
        _isConnected = true;
    }
コード例 #6
0
 public ChairGrid(ChairState value)
 {
     chairState = value;
     listChair  = new List <Chair>();
     InitializeComponent();
 }
コード例 #7
0
ファイル: ConvertibleChair.cs プロジェクト: tormibg/SoftUni-1
 public ConvertibleChair(string model, string material, decimal price, decimal height, int numberOfLegs)
     : base(model, material, price, height, numberOfLegs)
 {
     this.state = ChairState.Normal;
 }