示例#1
0
 // Update is called once per frame
 void FixedUpdate()
 {
     x          = Input.GetAxisRaw("Horizontal");
     y          = Input.GetAxisRaw("Vertical");
     movimiento = new Vector2(
         x,
         y
         );
     rb.MovePosition(rb.position + movimiento * velocidad * Time.deltaTime);
     if (pasto)
     {
         animator.SetLayerWeight(1, 1);
         animMov.Pasto(x, y);
     }
     else if (agua)
     {
         animator.SetLayerWeight(2, 1);
         animMov.Agua(x, y);
     }
     else
     {
         animator.SetLayerWeight(0, 1);
         animMov.Normal(x, y);
     }
 }