Beispiel #1
0
    public override void SpawnPowerUp()
    {
        bool flag = false;
        int  num  = 0;
        int  num2 = 10000;

        while (!flag)
        {
            object   obj      = this.worldSize * 0.5f;
            object   value    = Mathf.Lerp(RuntimeServices.UnboxSingle(RuntimeServices.InvokeUnaryOperator("op_UnaryNegation", obj)), RuntimeServices.UnboxSingle(obj), Random.get_value());
            object   value2   = Mathf.Lerp(RuntimeServices.UnboxSingle(RuntimeServices.InvokeUnaryOperator("op_UnaryNegation", obj)), RuntimeServices.UnboxSingle(obj), Random.get_value());
            Renderer renderer = (Renderer)this.powerUpPrefab.GetComponent(typeof(Renderer));
            float    num3     = (renderer.get_bounds().get_max() - renderer.get_bounds().get_min()).get_magnitude() * 0.5f;
            if (!Physics.CheckSphere(new Vector3(RuntimeServices.UnboxSingle(value), (float)0, RuntimeServices.UnboxSingle(value2)), num3 * (float)2))
            {
                PowerUp powerUp = (PowerUp)Object.Instantiate(this.powerUpPrefab);
                powerUp.get_transform().set_position(new Vector3(RuntimeServices.UnboxSingle(value), (float)0, RuntimeServices.UnboxSingle(value2)));
                flag = true;
            }
            checked
            {
                num++;
                if (num > num2)
                {
                    break;
                }
            }
        }
    }