Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (vertical)
     {
         vertical.Move(1);
     }
 }
Exemplo n.º 2
0
    private void OnCollisionEnter(Collision collision)
    {
        if (!random)
        {
            return;
        }
        hit = true;
        float u1            = 1.0f - Random.value; //uniform(0,1] random doubles
        float u2            = 1.0f - Random.value;
        float randStdNormal = Mathf.Sqrt(-2.0f * Mathf.Log(u1)) *
                              Mathf.Sin(2.0f * Mathf.PI * u2); //random normal(0,1)
        float randNormal = 0.5f * randStdNormal;               //random normal(mean,stdDev^2)

        if (verticalMove)
        {
            verticalMove.Move(randNormal);
        }
        if (horizontalMove)
        {
            horizontalMove.Move(randNormal);
        }
    }