public override void Move(CharacterController controller, Transform transform) { rotateDirection.Set(InputRotateX.SetFloat(), InputRotateY.SetFloat(), InputRotateZ.SetFloat()); transform.Rotate(rotateDirection); moveDirection.Set(InputX.SetFloat(), InputY.SetFloat(), InputZ.SetFloat()); //changed y from InputY.SetFloat() if (!controller.isGrounded) { moveDirection.y -= gravity * Time.deltaTime; // Debug.Log("Gravity!" + moveDirection.y); } moveDirection = transform.TransformDirection(moveDirection); if (moveSpeedMultiplier != null) { moveDirection *= speed * moveSpeedMultiplier.FloatValue; } else { moveDirection *= speed; } if (JumpInput.SetFloat() != 0) { moveDirection.y = JumpInput.SetFloat(); } //Debug.Log(moveDirection); controller.Move(moveDirection * Time.deltaTime); }
public void Compute() { //int iX = InputX.Get2sComplement(), iY = InputY.Get2sComplement(); int iX = InputX.GetValue(), iY = InputY.GetValue(); if (ZeroX.Value == 1) { iX = 0; } if (ZeroY.Value == 1) { iY = 0; } if (NotX.Value == 1) { iX = ~iX; } if (NotY.Value == 1) { iY = ~iY; } int iResult = 0; if (F.Value == 0) { iResult = iX & iY; } else { iResult = iX + iY; } if (NotOutput.Value == 1) { iResult = ~iResult; } Output.SetValue(iResult); //Output.Set2sComplement(iResult); if (iResult == 0) { Zero.Value = 1; } else { Zero.Value = 0; } if (Output.GetValue() < 0) { Negative.Value = 1; } else { Negative.Value = 0; } //Console.WriteLine("ALU state: " + ToString()); }
IEnumerator HoldKey(InputX input) { while (routineActive) { ChangeOrActivateTool(input); yield return(new WaitForSeconds(0.03f)); } }
private void clearLab1_Click(object sender, EventArgs e) { b.Clear(); InputA.Clear(); InputX.Clear(); Lab1N1V.Clear(); Lab1N2F.Clear(); Lab1N1S.Clear(); }
private void FixedUpdate() { if (_health.Health <= 0) { return; } _body.AddForce(InputX.GetAxis() * _movement.Speed * 4.5f * (_body.velocity.magnitude < 5 ? 3.5f : 1), ForceMode2D.Impulse); //_body.MovePosition(_body.position + InputX.GetAxis() * _movement.ActualSpeed); }
public override bool TestGate() { InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 0; NotOutput.Value = 1; Console.WriteLine("Case 1: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 1; F.Value = 0; NotOutput.Value = 0; Console.WriteLine("Case 2: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); InputX.SetValue(6); InputY.SetValue(5); ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 1; F.Value = 0; NotOutput.Value = 1; if (Output.Get2sComplement() != -7 || Zero.Value != 0 || Negative.Value != 1) { return(false); } ZeroX.Value = 1; ZeroY.Value = 1; NotX.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 0; if (Output.Get2sComplement() != 0 || Zero.Value != 1 || Negative.Value != 0) { return(false); } return(true); }
public override void Move(CharacterController controller, Transform transform) { if (controller.isGrounded) { moveDirection.Set(InputX.SetFloat(), InputY.SetFloat(), InputZ.SetFloat()); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; //moveDirection.y = JumpInput.SetFloat(); } moveDirection.y -= gravity * Time.deltaTime; controller.Move(moveDirection * Time.deltaTime); }
private void Update() { if (!_moving && InputX.GetAxis().sqrMagnitude > 0.001) { _moving = true; OnStartedMove.Invoke(); } else if (_moving && InputX.GetAxis().sqrMagnitude <= 0.001) { _moving = false; OnStoppedMove.Invoke(); } _body.MovePosition(_body.position + InputX.GetAxis() * _stats.MovementSpeed * Time.deltaTime); }
private IEnumerator routeFollower; //GoByTheRoute corountine i buna esitleniyor sonra bu corountine stoplaniyor void Start() { inputX = new InputX(); p0 = route.GetChild(0).position; p1 = route.GetChild(1).position; p2 = route.GetChild(2).position; p3 = route.GetChild(3).position; tParam = 0.5f; speedModifier = 1.5f; coroutineAllowed = true; SetGunPosition(); }
void Start() { inputX = new InputX(); currSpeed = defaultSpeed; mouseRotation = transform.rotation; movementKeysRotation = transform.rotation; //set input events InputEventManager.inputEvent.onMouseMoved += OnMouseMoved; InputEventManager.inputEvent.onKeyboardMove += OnMove; InputEventManager.inputEvent.onPressedShift += OnPressedSprint; InputEventManager.inputEvent.onReleasedShift += OnReleasedSprint; InputEventManager.inputEvent.onPressedSpace += OnPressedJump; InputEventManager.inputEvent.onReleasedSpace += OnReleasedJump; }
//methods #region private void ChangeOrActivateTool(InputX input) { switch (ActiveToolHeader) { case ToolHeader.numParts: { NumberOfParts.ChangeTool(input); break; } case ToolHeader.partType: { PartType.ChangeTool(input); break; } case ToolHeader.ruleFilter: { RuleFilter.ChangeTool(input); break; } case ToolHeader.placeType: { PlacementType.ChangeTool(input); break; } case ToolHeader.saveLoad: { SaveLoad.ChangeTool(input); break; } case ToolHeader.simStat: { SimulateStatics.ChangeTool(input); break; } } }
void Start() { uiManager = FindObjectOfType(typeof(UIManager)) as UIManager; playerSpeed = 0.4f; isGameStarted = false; t0 = bezierRoute.GetChild(0); t1 = bezierRoute.GetChild(1); t2 = bezierRoute.GetChild(2); t3 = bezierRoute.GetChild(3); tParam = 0.5f; inputX = new InputX(); moveHandsToRight = false; moveHandsToLeft = false; armPos = Vector3.zero; }
public override bool TestGate() { int wordBitsFilter = WordBitsFilter(); var wsFlags = new WireSet(6); int inputPermutationsCount = (int)Math.Pow(2, Size); int flagsPermutationsCount = (int)Math.Pow(2, wsFlags.Size); for (int i = 0; i < inputPermutationsCount; i++) { InputX.SetValue(i); for (int j = 0; j < inputPermutationsCount; j++) { InputY.SetValue(j); for (int k = 0; k < flagsPermutationsCount; k++) { wsFlags.SetValue(k); SetFlags(wsFlags); bool test = Test( wordBitsFilter, InputX.Get2sComplement(), InputY.Get2sComplement(), ZeroX.Value, NotX.Value, ZeroY.Value, NotY.Value, F.Value, NotOutput.Value ); if (!test) { return(false); } } } } return(true); }
void Start() { inputX = new InputX(); ragdollMat = GetComponentInChildren <Renderer>().material; //uncomment this to give ragdoll a color (one of hex colors) at the start of level //ragdollMat.color = DataScript.hexColors[ragdollColorNo]; ragdollCountText = GetComponentInChildren <Text>(); SetCountText(); initialYPos = transform.position.y; animator = GetComponent <Animator>(); r0 = route.GetChild(0); r1 = route.GetChild(1); r2 = route.GetChild(2); r3 = route.GetChild(3); tParam = 0; moveSpeed = 1f; initialScale = transform.localScale; }
public override void Move(CharacterController controller, Transform transform) { if (!controller.isGrounded) { moveDirection.y -= gravity * Time.deltaTime; } rotateDirection.Set(InputRotateX.SetFloat(), InputRotateY.SetFloat(), InputRotateZ.SetFloat()); transform.Rotate(rotateDirection); moveDirection.Set(InputX.SetFloat(), InputY.SetFloat(), InputZ.SetFloat()); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; if (JumpInput.SetFloat() != 0) { moveDirection.y = JumpInput.SetFloat(); } //Debug.Log(moveDirection); controller.Move(moveDirection * Time.deltaTime); }
private static void UpdateTimedInputClocks() { if (timedInputArray != null) { while (timedInputIndex < timedInputArray.Length) { if (timedInputArray[timedInputIndex].updateTimeGlobally) { if (InputX.Pressed(timedInputArray[timedInputIndex].inputs)) { timedInputArray[timedInputIndex].clock += Time.unscaledDeltaTime; } else { timedInputArray[timedInputIndex].clock = 0; } } timedInputIndex++; } timedInputIndex = 0; } }
private bool TestNumbers(int iX, int iY) { InputX.SetValue(iX); InputY.SetValue(iY); SetControlBits(1, 0, 1, 0, 1, 0); if (Output.GetValue() != 0) { return(false); } SetControlBits(1, 1, 1, 1, 1, 1); if (Output.GetValue() != 1) { return(false); } SetControlBits(1, 1, 1, 0, 1, 0); if (Output.GetValue() != -1) { return(false); } SetControlBits(0, 0, 1, 1, 0, 0); if (Output.GetValue() != iX) { return(false); } SetControlBits(1, 1, 0, 0, 0, 0); if (Output.GetValue() != iY) { return(false); } SetControlBits(0, 0, 1, 1, 0, 1); if (iX > 0 && Output.GetValue() != ~iX) { return(false); } SetControlBits(1, 1, 0, 0, 0, 1); if (iY > 0 && Output.GetValue() != ~iY) { return(false); } SetControlBits(0, 1, 1, 1, 1, 1); if (Output.GetValue() != iX + 1) { return(false); } SetControlBits(1, 1, 0, 1, 1, 1); if (Output.GetValue() != iY + 1) { return(false); } SetControlBits(0, 0, 1, 1, 1, 0); if (Output.GetValue() != iX - 1) { return(false); } SetControlBits(1, 1, 0, 0, 1, 0); if (Output.GetValue() != iY - 1) { return(false); } SetControlBits(0, 0, 0, 0, 1, 0); if (Output.GetValue() != iX + iY) { return(false); } SetControlBits(0, 1, 0, 0, 1, 1); if (Output.GetValue() != iX - iY) { return(false); } SetControlBits(0, 0, 0, 1, 1, 1); if (Output.GetValue() != iY - iX) { return(false); } SetControlBits(0, 0, 0, 0, 0, 0); if (Output.GetValue() != (iY & iX)) { return(false); } SetControlBits(0, 1, 0, 1, 0, 1); if (Output.GetValue() != (iY | iX)) { return(false); } return(true); }
void Start() { inputX = new InputX(); }
public float Axis(bool firstFixedOnly = false) { return(InputX.Axis(this.inputs, firstFixedOnly)); }
public bool Pressed(bool firstFixedOnly = false) { return(InputX.Pressed(this.inputs, firstFixedOnly)); }
public bool Up(bool firstFixedOnly = false) { return(InputX.Up(this.inputs, firstFixedOnly)); }
//InputX method shortcuts public bool Down(bool firstFixedOnly = false) { return(InputX.Down(this.inputs, firstFixedOnly)); }
public override bool TestGate() { InputX.SetValue(6); InputY.SetValue(5); //setting ALU bit settings ZeroX.Value = 1; ZeroY.Value = 1; NotX.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 0; // if (Output.Get2sComplement() != 0 || Zero.Value != 1 || Negative.Value != 0) { return(false); } //setting ALU bit settings ZeroX.Value = 1; ZeroY.Value = 1; NotX.Value = 1; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; // if (Output.Get2sComplement() != 1 || Zero.Value != 0 || Negative.Value != 0) { return(false); } //setting ALU bit settings ZeroX.Value = 1; ZeroY.Value = 1; NotX.Value = 1; NotY.Value = 0; F.Value = 1; NotOutput.Value = 0; // if (Output.Get2sComplement() != -1 || Zero.Value != 0 || Negative.Value != 1) { return(false); } //setting ALU bit settings ZeroX.Value = 0; ZeroY.Value = 1; NotX.Value = 0; NotY.Value = 1; F.Value = 0; NotOutput.Value = 0; // if (Output.Get2sComplement() != 6 || Zero.Value != 0 || Negative.Value != 0) { return(false); } //setting ALU bit settings ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 0; NotOutput.Value = 0; // if (Output.Get2sComplement() != 5 || Zero.Value != 0 || Negative.Value != 0) { return(false); } //setting ALU bit settings ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 1; F.Value = 0; NotOutput.Value = 1; // if (Output.Get2sComplement() != -7 || Zero.Value != 0 || Negative.Value != 1) { return(false); } //setting ALU bit settings ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 0; NotOutput.Value = 1; // if (Output.Get2sComplement() != -6 || Zero.Value != 0 || Negative.Value != 1) { return(false); } //setting ALU bit settings ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; // if (Output.Get2sComplement() != -6 || Zero.Value != 0 || Negative.Value != 1) { return(false); } //setting ALU bit settings ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 1; // if (Output.Get2sComplement() != -5 || Zero.Value != 0 || Negative.Value != 1) { return(false); } //setting ALU bit settings ZeroX.Value = 0; NotX.Value = 1; ZeroY.Value = 1; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; // if (Output.Get2sComplement() != 7 || Zero.Value != 0 || Negative.Value != 0) { return(false); } //setting ALU bit settings ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; // if (Output.Get2sComplement() != 6 || Zero.Value != 0 || Negative.Value != 0) { return(false); } //setting ALU bit settings ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 1; F.Value = 1; NotOutput.Value = 0; // if (Output.Get2sComplement() != 5 || Zero.Value != 0 || Negative.Value != 0) { return(false); } //setting ALU bit settings ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 0; // if (Output.Get2sComplement() != 4 || Zero.Value != 0 || Negative.Value != 0) { return(false); } //setting ALU bit settings ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 0; // if (Output.Get2sComplement() != -5 || Zero.Value != 0 || Negative.Value != 1) { return(false); } //setting ALU bit settings ZeroX.Value = 0; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 1; // if (Output.Get2sComplement() != 1 || Zero.Value != 0 || Negative.Value != 0) { return(false); } //setting ALU bit settings ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 0; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; // if (Output.Get2sComplement() != -1 || Zero.Value != 0 || Negative.Value != 1) { return(false); } return(true); }
public override bool TestGate() { Console.WriteLine("TESTING FOR X=5, Y=3"); //1 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 1; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 0; F.Value = 1; NotOutput.Value = 0; Console.WriteLine("Case 1: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //2 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 1; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; Console.WriteLine("Case 2: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //3 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 1; NotY.Value = 0; F.Value = 1; NotOutput.Value = 0; Console.WriteLine("Case 3: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //4 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 1; F.Value = 0; NotOutput.Value = 0; Console.WriteLine("Case 4: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //5 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 0; NotOutput.Value = 0; Console.WriteLine("Case 5: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //6 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 1; F.Value = 0; NotOutput.Value = 1; Console.WriteLine("Case 6: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //7 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 0; NotOutput.Value = 1; Console.WriteLine("Case 7: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //8 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; Console.WriteLine("Case 8: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //9 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 1; Console.WriteLine("Case 9: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //10 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 1; ZeroY.Value = 1; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; Console.WriteLine("Case 10: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //11 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; Console.WriteLine("Case 11: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //12 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 1; NotY.Value = 1; F.Value = 1; NotOutput.Value = 0; Console.WriteLine("Case 12: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //13 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 1; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 0; Console.WriteLine("Case 13: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //14 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 0; Console.WriteLine("Case 14: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //15 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 0; F.Value = 1; NotOutput.Value = 1; Console.WriteLine("Case 15: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //16 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 0; NotY.Value = 1; F.Value = 1; NotOutput.Value = 1; Console.WriteLine("Case 16: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //17 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 0; ZeroY.Value = 0; NotY.Value = 0; F.Value = 0; NotOutput.Value = 0; Console.WriteLine("Case 17: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); //18 InputX.Set2sComplement(5); InputY.Set2sComplement(5); ZeroX.Value = 0; NotX.Value = 1; ZeroY.Value = 0; NotY.Value = 1; F.Value = 0; NotOutput.Value = 1; Console.WriteLine("Case 18: " + Output.Get2sComplement()); Console.WriteLine("Negative?: " + Negative.Value); Console.WriteLine("Zero?: " + Zero.Value); Console.WriteLine(""); return(true); // throw new NotImplementedException(); }