I'm attempting to create a game in unity, but Java isn't able to be used in it, so any premade scripts are in C#. I want to add some stuff in the mechanics of the game, which requires me to alter variables and values in the script, but I only know how to do so in java, so how would I make it so they can effectively communicate?
An example from c#:
protected override void ComputeVelocity()
{
Vector2 move = Vector2.zero;
move.x = Input.GetAxis ("Horizontal");
if (Input.GetButtonDown ("Jump") && grounded) {
velocity.y = jumpTakeOffSpeed;
} else if (Input.GetButtonUp ("Jump"))
{
if (velocity.y > 0)
velocity.y = velocity.y * .5f;
}
targetVelocity = move * maxSpeed;
}
}
and my java code:
public void keyPressed(KeyEvent e)
{
if(e.getKeyCode() == KeyEvent.VK_SHIFT)
{
endTime = (System.currentTimeMillis() / 1000);
timePassed = endTime - startTime;
if(timePassed >= 2)
{
//try to set a time limit or something
velocity = overMaxVelocity;
//set velocity to above usual max for dodgeTime
startTime = dodgeTime + (System.currentTimeMillis() / 1000);
}
}
}
I'm trying to make it so when shift is pressed, the velocity is changed to a larger value than usual for a small time, but i have no idea where to even begin