private void Update()
 {
     if (Input.GetMouseButton(0))
     {
         var        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (col.Raycast(ray, out hit, float.MaxValue))
         {
             var uv = hit.textureCoord;
             stamp.Draw(canvas, uv, scale * Vector2.one, density);
             Debug.LogFormat("Draw on uv={0}", uv);
         }
     }
 }
示例#2
0
    private void Update()
    {
        validator.Validate();

        if (Input.GetMouseButton(0))
        {
            var        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (col.Raycast(ray, out hit, float.MaxValue))
            {
                var uv = hit.textureCoord;
                uv.y = 0.5f;
                var w     = 2f * Mathf.PI * Time.time;
                var power = intakePower;
                stamp.Draw(u0, uv, 0.02f * Vector2.one, power);
            }
        }

        if (update)
        {
            time += Time.deltaTime * speed;
            while (time >= dt)
            {
                time -= dt;
                wave.Next(u1, u0, v, b);
                Swap();
                if (wave.Damp > 0)
                {
                    wave.Clamp(u1, u0, v, b);
                    Swap();
                }
            }
        }

        graph.Input         = u0;
        rend.sharedMaterial = graph.Output;
    }