public override void ReadInput(InputDataStruct data) { prevFlyVelocity = flyVelocity; ResetMovementToZero(); if (data.axesTab[1] != 0) { actualTurningAngel = turningAngelValuePerSecond * Time.deltaTime * (data.axesTab[1] > 0 ? 1 : -1); if (data.axesTab[1] > 0) { _playerStateInfo.text = "FLY - TURN RIGHT"; } else if (data.axesTab[1] < 0) { _playerStateInfo.text = "FLY - TURN LEFT"; } } //vertical movement if (data.axesTab[0] != 0f) { flyVelocity += Vector3.forward * data.axesTab[0] * horizontalSpeed; _playerStateInfo.text = "FLY - FORWARD"; } //horizontal movement if (data.axesTab[1] != 0f) { flyVelocity += Vector3.right * data.axesTab[1] * horizontalSpeed; } //increase plane's flight altitude if (data.buttonsTab[0] == true) { flyVelocity += Vector3.up * verticalSpeed; _playerStateInfo.text = "FLY - UP"; } //decrease plane's flight altitude if (data.buttonsTab[1] == true) { flyVelocity += Vector3.up * -verticalSpeed * 1.5f; _playerStateInfo.text = "FLY - DOWN"; } //check exit from airplane if (data.buttonsTab[2] == true) { PilotExit(); } newInput = true; }
internal InputDataStruct[] GetPersonsInBatchStructs(int amount) { InputDataStruct[] result = new InputDataStruct[amount]; for (int i = 0; i < amount; ++i) { result[i] = new InputDataStruct() { Firstname = "A", Lastname = "B", BirthDate = DateTime.Now.AddYears(20), EmployeeId = Guid.NewGuid() }; } return(result); }
internal InputDataStruct[] GetDataArrayPoolStructs(int amount) { InputDataStruct[] result = ArrayPool <InputDataStruct> .Shared.Rent(amount); for (int i = 0; i < amount; ++i) { result[i] = new InputDataStruct() { Firstname = "A", Lastname = "B", BirthDate = DateTime.Now.AddYears(20), EmployeeId = Guid.NewGuid() }; } return(result); }
public override void ReadInput(InputDataStruct data) { //turning if (data.axesTab[1] != 0) { actualTurning = turningAngleValuePerSecond * Time.deltaTime * (data.axesTab[1] > 0 ? 1 : -1); if (data.axesTab[1] > 0) { _playerStateInfo.text = "CAR - TURN RIGHT"; } else if (data.axesTab[1] < 0) { _playerStateInfo.text = "CAR - TURN LEFT"; } } //moving backward if (data.axesTab[0] < 0) { isBackward = true; _playerStateInfo.text = "CAR - BACKWARD"; } //acceleration if (data.buttonsTab[0] == true) { CarAcceleration(accelerationPerSecond); _playerStateInfo.text = "CAR - FORWARD"; } //braking if (data.buttonsTab[1] == true) { CarStoping(brakingRatePerSecond); _playerStateInfo.text = "CAR - STOP"; } //exit if (data.buttonsTab[2] == true) { _playerStateInfo.text = "CAR - EXIT"; GetOutFromCar(); } newInput = true; }
public List <string> PeopleEmployeedWithinLocation_Structs(int amount) { LocationStruct location = new LocationStruct(); List <string> result = new List <string>(); InputDataStruct[] input = service.GetPersonsInBatchStructs(amount); DateTime now = DateTime.Now; for (int i = 0; i < input.Length; ++i) { ref InputDataStruct item = ref input[i]; if (now.Subtract(item.BirthDate).TotalDays > 18 * 365) { var employee = service.GetEmployeeStruct(item.EmployeeId); if (locationService.DistanceWithStruct(ref location, employee.Address) < 10.0) { string name = string.Format("{0} {1}", item.Firstname, item.Lastname); result.Add(name); } } }
//TODO: Add method ReadInput public abstract void ReadInput(InputDataStruct data);
protected bool isNewData;//tracking if is new data input in void Awake() { _inputManager = GetComponent <InputManager>(); _inputData = new InputDataStruct(_inputManager.AxisNumber, _inputManager.ButtonsNumber); }
public override void ReadInput(InputDataStruct data) { previosWalkingVector = walkingVector; ResetMovingToZero(); if (data.buttonsTab[3] == true) { walkingSpeed = 5; } else { walkingSpeed = deafaultWalkingSpeed; } //turning player if (data.axesTab[2] != 0) { actualTurningAngel = turningAngleValuePerSeconc * Time.deltaTime * (data.axesTab[2] > 0 ? 1 : -1); } //set vertical movement if (data.axesTab[0] != 0f) { walkingVector += Vector3.forward * data.axesTab[0] * walkingSpeed; if (data.axesTab[0] > 0) { infoText.text = "WALKING - FORWARD"; } else if (data.axesTab[0] < 0) { infoText.text = "WALKING - BACK"; } } //set horizontal movement if (data.axesTab[1] != 0f) { walkingVector += Vector3.right * data.axesTab[1] * walkingSpeed; if (data.axesTab[1] > 0) { infoText.text = "WALKING - RIGHT"; } else if (data.axesTab[1] < 0) { infoText.text = "WALKING - LEFT"; } } //set vertical jump if (data.buttonsTab[0] == true) { if (jumpingPressTime == 0f) { if (CheckIsPlayerOnGround()) { jumpVectorSpeed = jumpingForce; infoText.text = "JUMP !!!"; } } jumpingPressTime += Time.deltaTime; } else { jumpingPressTime = 0f; } //check if interact button is pressed if (data.buttonsTab[1] == true) { if (OnInteraction != null) { OnInteraction(interactingTimeDuration, 0, ActionType.Interact); } } //check if attack button is pressed if (data.buttonsTab[2] == true) { if (OnInteraction != null) { OnInteraction(interactingTimeDuration, attackDamagePoint, ActionType.Attack); } } newInput = true; }
public void PassInputData(InputDataStruct dataInput) { //Debug.Log("Mov : "+data.axes[0] + " : " + data.axes[1]); controller.ReadInput(dataInput); }