Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     //health.text = "HP: " + hp;
     if (onGround)
     {
         //rBody.velocity = Vector2.zero;
         if ((!Input.GetKey(ManagerSettings.getControls(player).moveLeft) && !Input.GetKey(ManagerSettings.getControls(player).moveRight)) || Input.GetKey(ManagerSettings.getControls(player).attack))
         {
             anim.SetBool("WalkF", false);
             anim.SetBool("WalkB", false);
             anim.SetBool("Neutral", true);
             rBody.velocity = Vector2.zero;
             if (Input.GetKey(ManagerSettings.getControls(player).attack))
             {
                 anim.SetBool("Punching", true);
                 attacking = true;
             }
         }
         if (Input.GetKeyUp(ManagerSettings.getControls(player).attack))
         {
             anim.SetBool("Punching", false);
             attacking = false;
         }
         if (Input.GetKeyDown(ManagerSettings.getControls(player).jump) && !anim.GetBool("Punching"))
         {
             anim.SetTrigger("Jump");
             jump();
         }
     }
     else
     {
         anim.SetBool("Land", false);
         if (Input.GetKeyDown(ManagerSettings.getControls(player).attack))
         {
             anim.SetBool("Punching", true);
             attacking = true;
         }
         if (Input.GetKeyUp(ManagerSettings.getControls(player).attack))
         {
             anim.SetBool("Punching", false);
             attacking = false;
         }
     }
     if (Input.GetKeyDown(ManagerSettings.getControls(player).moveRight))
     {
         moveRight();
     }
     else if (Input.GetKeyDown(ManagerSettings.getControls(player).moveLeft))
     {
         moveLeft();
     }
     if (!isTargetInFront())
     {
         flip();
     }
 }