как бороться ?
using UnityEngine;
using System.Collections;
public class MoveByDisplay : MonoBehaviour
{
public Rigidbody2D rb2d;
public float playerSpeed;
public float jumpPower;
public int directionInput;
public bool groundCheck;
public bool facingRight = true;
public int jumpsLimit;
public int jumpsDone;
void Start()
{
rb2d = GetComponent<Rigidbody2D>();
}
void Update()
{
if ((directionInput < 0) && (facingRight))
{
Flip();
}
if ((directionInput > 0) && (!facingRight))
{
Flip();
}
groundCheck = true;
}
void FixedUpdate()
{
rb2d.velocity = new Vector2(playerSpeed * directionInput, rb2d.velocity.y);
}
public void Move(int InputAxis)
{
directionInput = InputAxis;
}
public void Jump()
{
rb2d.AddForce(Vector2.up * jumpPower * playerSpeed);
}
void Flip()
{
facingRight = !facingRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
public void Jump()
{
if (jumpsDone < jumpsLimit)
{
rb2d.AddForce(Vector2.up * jumpPower * playerSpeed);
jumpsdone++;
}
}
}