Beispiel #1
0
        public virtual bool checkObjectHitsFloor(IGravityClient object_)
        {
#if USE_3D_RAYS
            RayInformation3D rayInformation = object_.getRayInformation3D();
            RayHitboxes3D    rayHitboxes    = object_.getRayHitboxes3D();
#else
            RayInformation rayInformation = object_.getRayInformation();
            RayHitboxes    rayHitboxes    = object_.getRayHitboxes();
#endif
            rayInformation.checkRaysBelow(object_, 0.0f,
                                          object_.getTransform().eulerAngles.z + 270.0f,
                                          layermask);
            float correction = 0.0f;
            float minimalSpaceBetweenTileBelow = rayInformation.MinimalSpaceBetweenTileBelow;

            bool objectOnFloor = (rayHitboxes.DistanceBelow <
                                  minimalSpaceBetweenTileBelow * rayInformation.BelowTolerance) ? true :
                                 ((multiplyYVelocityDown * yFallDistance) > (rayHitboxes.DistanceBelow -
                                                                             minimalSpaceBetweenTileBelow)) ? true : false;

            if (objectOnFloor)
            {
                correction = -(rayHitboxes.DistanceBelow -
                               rayInformation.MinimalSpaceBetweenTileBelow);
                moveEntity(object_, correction);
            }

            return(objectOnFloor);
        }
Beispiel #2
0
        public override RayInformation3D getRayInformation3D()
        {
            RayInformation3D returnValue = actor.RayInformation3D;

            if (hasFlippedRayInformation && player.SpriteRenderer.flipX)
            {
                returnValue = player.RayInformationFlippedX3D;
            }
            return(returnValue);
        }
Beispiel #3
0
        public virtual bool checkObjectHitsPlatform(float yModifier, IGravityClient object_)
        {
#if USE_3D_RAYS
            RayInformation3D rayInformation = object_.getRayInformation3D();
            RayHitboxes3D    rayHitboxes    = object_.getRayHitboxes3D();
#else
            RayInformation rayInformation = object_.getRayInformation();
            RayHitboxes    rayHitboxes    = object_.getRayHitboxes();
#endif
            rayInformation.checkRaysTop(object_, 0.0f, object_.getTransform().eulerAngles.z + 90.0f, layermask);
            bool objectHitTop = (rayHitboxes.DistanceTop <
                                 rayInformation.MinimalSpaceBetweenTileTop) ? true :
                                (yModifier > (rayHitboxes.DistanceTop -
                                              rayInformation.MinimalSpaceBetweenTileTop)) ? true : false;

            if (objectHitTop)
            {
                float correction = -(rayHitboxes.DistanceTop -
                                     rayInformation.MinimalSpaceBetweenTileTop);
                moveEntity(object_, correction);
                checkObjectHitsFloor(object_);
            }
            return(objectHitTop);
        }