void OnShake(ShakeEventArgs args)
 {
     if (Shaken != null)
     {
         Shaken(this, args);
     }
 }
Esempio n. 2
0
        void Blob_Shaken(object sender, ShakeEventArgs e)
        {
            Vector3 dirPlane = Vector3.Normalize(
                Vector3.Transform(triangle.Normal, Matrix.CreateFromQuaternion(statueTransform.Rotation)));

            dirPlane.Z = 0;

            float distance = Vector3.Distance(dirPlane, e.Direction);

            if (distance < 1.0f) {
                Vector3 f = e.Force * (1.0f - distance);

                accumulatedForce += f;

                if (accumulatedForce.Length() > 1) {
                    released = true;

                    velocity = dirPlane * (1 + (float)(rand.NextDouble() + 0.1));

                    capturedStatueRotation = Matrix.CreateFromQuaternion(statueTransform.Rotation);
                }
            }
        }
 void OnShake(ShakeEventArgs args)
 {
     if (Shaken != null) {
         Shaken(this, args);
     }
 }