Exemple #1
0
    private void PhysicsEffect(Vector3 point, Vector3 normal)
    {
        if (physicsMode == PhysicsMode.Scattered)
        {
            PhysicsUtilities.CopyAllRigidbodies();
            PhysicsUtilities.DeleteRigidBodiesNotInParent(rootContainer);
        }
        switch (physicsEffects)
        {
        case PhysicsEffects.Explosion:
            PhysicsUtilities.AddExplosion(point, normal);
            break;

        case PhysicsEffects.BlackHole:
            PhysicsUtilities.AddBlackHole(point, normal);
            break;

        case PhysicsEffects.SimpleForce:
            PhysicsUtilities.AddSimpleForce(point, normal);
            break;
        }

        if (physicsMode == PhysicsMode.Scattered)
        {
            PhysicsUtilities.PasteRigidbodies();
            var rigidbodyContainer = GameObject.Find("Rigidbody Container");
            GameObject.DestroyImmediate(rigidbodyContainer);
        }
        PhysicsUtilities.ActivatePhysics();
    }