示例#1
0
 void Update()
 {
     speed         = (transform.position - last_position).magnitude / Time.deltaTime;
     last_position = transform.position;
     if (Time.time % 0.2F < 0.01F)
     {
         Vector3 p = transform.position + transform.rotation * offset;
         if (OceanAdvanced.GetWaterHeight(p) > p.y)
         {
             ocean.RegisterInteraction(p, Mathf.Clamp01(speed / 15.0F) * 0.5F);
         }
     }
 }
示例#2
0
    void CheckSplash()
    {
        speed = (transform.position - last_position).magnitude / 0.5F;
        if (speed < 3F)
        {
            return;
        }
        Vector3 p = transform.position + transform.rotation * offset;
        float   h = OceanAdvanced.GetWaterHeight(p);

        if (p.y < h && last_position.y > h && speed > 2.0F)
        {
            ocean.RegisterInteraction(p, Mathf.Clamp01(speed / 15.0F) * 0.5F);
        }

        last_position = transform.position;
    }