mirror of
https://github.com/ConjureETS/OuijaMTLGJ2016.git
synced 2026-03-24 02:01:06 +00:00
38 lines
630 B
JavaScript
38 lines
630 B
JavaScript
#pragma strict
|
|
internal var animator:Animator;
|
|
var playerNumber:int;
|
|
var v:float;
|
|
var h:float;
|
|
var run:float;
|
|
|
|
function Start () {
|
|
animator=GetComponent (Animator);
|
|
}
|
|
|
|
function Update () {
|
|
v=Input.GetAxis("Vertical"+playerNumber);
|
|
h=Input.GetAxis("Horizontal"+playerNumber);
|
|
if (animator.GetFloat("Run")==0.2){
|
|
if (Input.GetKeyDown("space")){
|
|
animator.SetBool("Jump",true);
|
|
}
|
|
}
|
|
Sprinting();
|
|
|
|
}
|
|
|
|
function FixedUpdate (){
|
|
animator.SetFloat("Walk",v);
|
|
animator.SetFloat("Run",run);
|
|
animator.SetFloat("Turn",h);
|
|
}
|
|
|
|
function Sprinting(){
|
|
if (Input.GetKey(KeyCode.LeftShift)){
|
|
run=0.2;
|
|
}
|
|
else
|
|
{
|
|
run=0.0;
|
|
}
|
|
} |