Example #1
0
        private void checkWeight(AbstractActivator activator)
        {
            CollisionActivator collisionActivator = activator as CollisionActivator;

            if (collisionActivator != null)
            {
                setCurrentMeasuredWeight(getEffectiveWeightOfMeasuredBodies(collisionActivator));
            }
        }
Example #2
0
 private float getEffectiveWeightOfMeasuredBodies(CollisionActivator collisionActivator)
 {
     return(collisionActivator.getCollidingObjects()
            .Where(collidingObject => (collidingObject.GetComponent <Rigidbody>() != null) || (collidingObject.GetComponent <Rigidbody2D>() != null))
            .Sum(collidingObject => getEffectiveWeightFromBody(collidingObject.GetComponent <Rigidbody>(), collidingObject.GetComponent <Rigidbody2D>())));
 }