private double CalcNewAngle(InputInformation inputInformation) { double result = 0; double cY = Math.Round(inputInformation.Acceleration.Y / conversion, 5); double cX = Math.Round(inputInformation.Acceleration.X / conversion, 5); if (cX < 0) { if (cY < 0) { if (cX <= cY) { result = calcTest(cX, cY, 45, 1); } else { result = calcTest(cX, cY, 45, -1); } } else { if (Math.Abs(cX) <= Math.Abs(cY)) { result = calcTest(cX, cY, 315, -1); } else { result = calcTest(cX, cY, 315, 1); } } } else { if (cY < 0) { if (Math.Abs(cX) <= Math.Abs(cY)) { result = calcTest(cX, cY, 135, -1); } else { result = calcTest(cX, cY, 135, 1); } } else { if (Math.Abs(cX) <= Math.Abs(cY)) { result = calcTest(cX, cY, 225, 1); } else { result = calcTest(cX, cY, 225, -1); } } } return(result); }
protected override void UpdateInputInformation(InputInformation inputInformation) { inputInformation.GetLocomotionInformation.ShouldJump = Input.GetKeyDown(_jumpKeyCode); inputInformation.GetLocomotionInformation.ShouldRun = Input.GetKey(_runKeyCode); inputInformation.GetLocomotionInformation.MovementDirection .Set(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical")); }
private double CalcNewAccelaration(InputInformation inputInformation) { double cY = Math.Round(inputInformation.Acceleration.Y / conversion, 5); double cX = Math.Round(inputInformation.Acceleration.X / conversion, 5); return((Math.Abs(cY) + Math.Abs(cX)) * 10); }
// Use this for initialization void Start () { Information = GetComponent<InputInformation>(); rb = GetComponent<Rigidbody>(); }
//////////////////////////// ////////// Method ////////// //////////////////////////// /// <summary> /// Simulate the transition in order to get the resulting action state /// </summary> public AActionState Simulate(InputInformation inputInformation) { if (_actionConditions.All(ac => ac.IsConditionFulfilled(inputInformation))) { return(_actionStateOnSuccess); } return(_actionStateOnFailure); }
// Use this for initialization void Start () { this.latestCorrectPos = transform.position; this.onUpdatePos = transform.position; Vehicles = GetComponent<Vehicle>(); InputInfo = GetComponent<InputInformation>(); }
public void Update(GameTime gameTime, InputInformation inputInformation) { if (inputInformation.ScreenTouched && !_isInGame) { Context.ActivateState(new StateExecuteGame(Context)); } _gameScreenSequenceExecution.Update(gameTime, inputInformation); }
protected override void UpdateInputInformation(InputInformation inputInformation) { if (Vector3.Distance(_destinationPosition, _target.position) > _NavMeshAgent.stoppingDistance) { _NavMeshAgent.SetDestination(_target.position); _destinationPosition = _NavMeshAgent.destination; } inputInformation.GetLocomotionInformation.MovementDirection = GetNextDirection; }
public void Update(InputInformation inputInformation) { if (inputInformation.ScreenTouched) { if (inputInformation.LastTouchArea.Intersects(Bounds)) { OnClick.Invoke(); } } }
public override void UpdateAction(ACharacterSystem characterSystem, InputInformation inputInformation) { var human = characterSystem as HumanSystem; human.transform.Rotate(0f , inputInformation.GetLocomotionInformation.MovementDirection.x * human.GetLocomotionProfile.AngularSpeed * Time.deltaTime , 0f, Space.Self); human.transform.Translate(0f, 0f, inputInformation.GetLocomotionInformation.MovementDirection.z * human.GetLocomotionProfile.WalkSpeed * Time.deltaTime, Space.Self); }
//////////////////////////// ////////// Method ////////// //////////////////////////// ///////////////////////// ////////// API ////////// /// <summary> /// Attempt to return the next action state /// </summary> public AActionState AttemptToGetNextActionState(InputInformation inputInformation) { foreach (var actionTransition in _actionTransitions) { var nextActionState = actionTransition.Simulate(inputInformation); if (nextActionState) { return(nextActionState); } } return(null); }
private void addButton_Click(object sender, EventArgs e) { if (nameSurnameTbox.Text != string.Empty && !nameSurnameTbox.Text.StartsWith(" ") && !nameSurnameTbox.Text.Any(char.IsDigit)) { studentListBox.Items.Add(InputInformation.CorrectInputFormat(nameSurnameTbox.Text)); nameSurnameTbox.Text = string.Empty; } else { nameSurnameTbox.Text = string.Empty; } ChangeStudentPanelSetting(); }
internal void Handle(List <GameObject> gameObjects, InputInformation inputInformation) { double newDirection = CalcNewAngle(inputInformation); double newAccel = CalcNewAccelaration(inputInformation); foreach (GameObject gameObject in gameObjects) { if (gameObject.Stability >= 100000) { continue; } UpdateSpeed(gameObject, newDirection, newAccel); UpdateDicection(gameObject, newDirection, newAccel); } }
private void Backspace(Object paramater)//Backspace { string s = paramater as string; if (InputInformation == "" || OperationResult == "") { OperationResult = "0"; InputInformation = ""; OperationLabel = " "; Number = 0; } else { OperationResult = OperationResult.Substring(0, OperationResult.Length - 1); InputInformation = InputInformation.Substring(0, InputInformation.Length - 1); } }
public override void EndAction(ACharacterSystem characterSystem, InputInformation inputInformation) { }
public override void UpdateAction(ACharacterSystem characterSystem, InputInformation inputInformation) { var human = characterSystem as HumanSystem; human.GetRigidbody.AddForce(0f, human.GetLocomotionProfile.JumpForce, 0f, ForceMode.Impulse); }
private void HandleGameState(GameTime gameTime, InputInformation inputInformation) { }
public override void Update(GameTime gameTime, InputInformation inputInformation) { base.Update(gameTime, inputInformation); }
private void HandleInput(List <GameObject> gameObjects, InputInformation inputInformation) { _inputInformation = inputInformation; // !!!!!!!!!!! Comment in after test !!!!!!!!!!!! _inputHandler.Handle(gameObjects, inputInformation); }
public virtual void Update(GameTime gameTime, InputInformation inputInformation) { _currentExecutionScreen.Update(gameTime, inputInformation); }
private SalesEstimator EmailMessageItemProcessed(EmailMessageItem message, IEnumerable <LanguageMapping> fromEnglishMappings, IEnumerable <LanguageMapping> toEnglishMappings, IProgress <EstimatorBaseProgress> progress) { String tempFolder = _settingsService.TempAttachmentFilePath; Boolean exists = Directory.Exists(tempFolder); if (!exists) { Directory.CreateDirectory(tempFolder); } String tempPath = String.Format("{0}{1}\\", tempFolder, DateTime.UtcNow.Ticks); exists = Directory.Exists(tempPath); if (!exists) { Directory.CreateDirectory(tempPath); } SalesEstimator model = new SalesEstimator(); String body = _emailExchangeService.GetEmailBody(message); ProgressLogTask(progress, String.Format("Parsing email {0}.", message.Subject)); WaitTask(); InputInformation inputInformation = _parsingService.ParseEmailBody(body, fromEnglishMappings, toEnglishMappings, model); String status = inputInformation.NonCorrectStatus; if (!String.IsNullOrWhiteSpace(status)) { String error = String.Format("Incorrect parsing email with Body: '{0}' <br>Error: {1}", body, status); throw new ApplicationException(error); } IList <Attachment> attach = _emailExchangeService.GetEmailAttachments(message); _fileService.FileProcessed(attach, progress, tempPath); ProgressLogTask(progress, String.Format("Sorting attachments {0}.", message.Subject)); IList <AttachmentUnit> units = _fileService.GetAttachmentUnits(tempPath); try { _zipService.UnzipProcessed(units, tempPath, progress); } catch (Exception exception) { model.AddError(exception.Message); } try { _imageService.AbbyProcessed(model, units, tempPath, progress); } catch (Exception exception) { model.AddError(exception.Message); } //convert all Xlsx and xls files to docx try { foreach (var unit in units.Where(u => u.CurrentType == FileType.Xlsx)) { ConvertExcelToText(unit, progress); } } catch (Exception ex) { model.AddError(ex.Message); } //convert all Pptx and Ppt files to docx try { foreach (var unit in units.Where(u => u.CurrentType == FileType.Pptx)) { ConvertPresentToText(unit, progress); } } catch (Exception ex) { model.AddError(ex.Message); } try { foreach (AttachmentUnit unit in units.Where(u => u.CurrentType == FileType.Docx)) { var statistic = GetStatistic(unit.PhisicalName, progress); String fileName = Path.GetFileName(unit.PhisicalName); model.WordCounterList.Add(new WordCounter { FileName = fileName, WordCount = statistic.Words, CharWithSpaceCount = statistic.CharsWithSpaces, CharWithoutSpaceCount = statistic.CharsWithoutSpaces, FullFilePath = unit.ZipFileName }); } } catch (Exception exception) { model.AddError(exception.Message); } foreach (AttachmentUnit unit in units.Where(u => u.CurrentType == FileType.None)) { String fileName = Path.GetFileName(unit.PhisicalName); model.NotSupportedFileList.Add(new WordCounter { FileName = fileName, WordCount = 0, FullFilePath = unit.ZipFileName }); } Directory.Delete(tempPath, true); return(model); }
public void Refresh(SpriteBatch spriteBatch, InputInformation inputInformation) { CalculatePhysics(_gameObjects); HandleInput(_gameObjects, inputInformation); }
public void Update(GameTime gameTime, InputInformation inputInformation) { throw new NotImplementedException(); }
/// <summary> /// Update the action /// </summary> /// <remarks> /// Call every FixedUpdate /// </remarks> public abstract void UpdateAction(ACharacterSystem characterSystem, InputInformation inputInformation);
/// <summary> /// Override the reset method of the input information /// </summary> /// <remarks> /// Note that InputInformation.Reset still happen before. Call every Update before UpdateInputInformation /// </remarks> protected abstract void OverrideInputInformationReset(InputInformation inputInformation);
public void Start() { vehicle = GetComponent<Vehicle>(); InputInfo = GetComponent<InputInformation>(); pickupUI = GameObject.FindObjectOfType<PickupUI>(); }
public void Update(GameTime gameTime, InputInformation inputInformation) { _gameScreenSequenceExecution.Update(gameTime, inputInformation); }
public void Update(GameTime gameTime, InputInformation inputInformation) { ExecutionState = InnerExecutionState.RUN; _inputInformation = inputInformation; }
/// <summary> /// Update the required input information used to drive the action /// </summary> /// <remarks> /// Call every Update after OverrideInputInformationReset /// </remarks> protected abstract void UpdateInputInformation(InputInformation inputInformation);
////////////////////////////// ////////// Callback ////////// /// <summary> /// Launch the action /// </summary> /// <remarks> /// Call when the action state is loaded /// </remarks> public abstract void BeginAction(ACharacterSystem characterSystem, InputInformation inputInformation);
internal void Update(GameTime gameTime, InputInformation currentInputInfo) { _currentState.Update(gameTime, currentInputInfo); }
public override bool IsConditionFulfilled(InputInformation inputInformation) { return(inputInformation.GetLocomotionInformation.ShouldRun); }
public virtual void Update(GameTime gameTime, InputInformation inputInformation) { ExecutionState = InnerExecutionState.RUN; _gameMediator.Refresh(_spriteBatch, inputInformation); }