Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Java to c#

  1. var numShots = 5; // Number of shots fired (should be odd);
  2. var spreadAngle = 2.0; // Angle between shots
  3. var timeBetweenShots = 0.5; // Minimum time between shots
  4. private var nextShot = 0.0;
  5. function Start() {
  6. if (numShots / 2 * 2 == numShots) numShots++; // Need an odd number of shots
  7. if (numShots < 3) numShots = 3; // At least 3 shots for a fan
  8. }
  9. function Update () {
  10. if(Input.GetKeyDown(KeyCode.Space) && Time.time > nextShot){
  11. nextShot = Time.time + timeBetweenShots;
  12. var qAngle = Quaternion.AngleAxis(-numShots / 2.0 * spreadAngle, transform.up) * transform.rotation;
  13. var qDelta = Quaternion.AngleAxis(spreadAngle, transform.up);
  14. for (var i = 0; i < numShots; i++) {
  15. var go : GameObject = Instantiate(playerProjectile, transform.position,qAngle);
  16. go.rigidbody.AddForce(go.transform.forward * 1000.0);
  17. qAngle = qDelta * qAngle;
  18. }
  19. }
  20. }

Can someone pls convert this java script to c#. I don't want the whole I just want




  1. nextShot = Time.time + timeBetweenShots;
  2. var qAngle = Quaternion.AngleAxis(-numShots / 2.0 * spreadAngle, transform.up) * transform.rotation;
  3. var qDelta = Quaternion.AngleAxis(spreadAngle, transform.up);


Thanks

Best Answer

Answers

  • Thank u.

    I appreciate your help.

  • sjainsjain Member

    The source code for instance .java report has been composed and changed over totally to bytecode. Bytecode can be run on any machine that has a Java virtual machine. Java virtual machine changes the bytecode into code that is PC gear runnable.

    A huge piece of the other programming vernaculars, for instance, COBOL, C++, Smalltalk or Visual Basic gather most of the code into twofold records. Twofold records are stage subordinate for instance programs made game plans for Intel-based Windows machines can't be run on Linux-based machines or Macs.

    Job Oriented Java Certification Course in Pune

Sign In or Register to comment.