阻止玩家在游戏开始时掉落并使用 tap 在 unity2D 中开始

stop player falling at start of game and use tap to start in unity2D

我正在 unity 5.3.5 中为 android 构建游戏,当点击屏幕时,玩家会向上移动并必须继续点击,但是当游戏开始时,玩家会掉落并退出游戏区域!我想要做的是让玩家在游戏开始时保持静止,这样当点击屏幕时游戏就开始了!这是代码..

public class Player : MonoBehaviour {

public string currentColor;

public float jumpForce = 10f;

public Rigidbody2D circle;
public SpriteRenderer sr;

public Color blue;
public Color yellow;
public Color pink;
public Color purple;

public static int score = 0;
public Text scoreText;

public GameObject obsticle;
public GameObject colorChanger;


void Start () {

    setRandomColor ();

}

// Update is called once per frame
void Update () {

        if (Input.GetButtonDown ("Jump") || Input.GetMouseButtonDown (0)) 

        {
            circle.velocity = Vector2.up * jumpForce;
        }

    scoreText.text = score.ToString ();
}

private void OnTriggerEnter2D(Collider2D collision)
{
    if (collision.tag == "Scored") 
    {
        score++;
        Destroy (collision.gameObject);
        Instantiate (obsticle, new Vector2(transform.position.x,transform.position.y + 7f), transform.rotation);
        return;
    }

    if (collision.tag == "ColorChanger") 
    {
        setRandomColor ();
        Destroy (collision.gameObject);
        Instantiate(colorChanger, new Vector2(transform.position.x,transform.position.y + 7f), transform.rotation);
        return;
    }

    if (collision.tag != currentColor) {
        Debug.Log ("You Died");
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        score = 0;
    }

    if (collision.tag == "Floor") 
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
}

void setRandomColor()
{
    int rand = Random.Range (0, 4);

    switch (rand) 
    {
    case 0:
        currentColor = "Blue";
        sr.color = blue;
        break;

    case 1:
        currentColor = "Yellow";
        sr.color = yellow;
        break;

    case 2:
        currentColor = "Pink";
        sr.color = pink;
        break;

    case 3:
        currentColor = "Purple";
        sr.color = purple;
        break;
    }
}

}

先做circle.isKinematic = true;
第一次点击进入 circle.isKinematic = false;