Ejemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        rb      = GetComponent <Rigidbody2D>();
        rb.drag = drag;

        gameManager = GameObject.Find("GameManager").GetComponent <tm_GameManager>();
    }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        cam = Camera.main;

        camHeight = cam.orthographicSize;
        camWidth  = camHeight * cam.aspect;

        gameManager = GameObject.Find("GameManager").GetComponent <tm_GameManager>();

        rotation = Random.Range(-initialRotation, initialRotation);

        // déterminer la vitesse x / y
        float x = Random.Range(-initialSpeed, initialSpeed);
        float y = Random.Range(-initialSpeed, initialSpeed);

        speed = new Vector2(initialSpeed, 0);

        // appliquer la vélocité
        rb          = GetComponent <Rigidbody2D>();
        rb.velocity = speed;
    }