예제 #1
0
 public PlatformMovement(
     BackingBox BackingBox,
     IPlatformInputHandler InputHandler,
     int MaxSpeed,
     int MinSpeed,
     int JumpStrength,
     int GravityStrength,
     int Acceleration,
     int Decceleration,
     int AirAcceleration,
     int AirDecceleration,
     HitGroundBehavior HGB = HitGroundBehavior.None
     )
 {
     this.BackingBox       = BackingBox;
     this.InputHandler     = InputHandler;
     this.MaxSpeed         = MaxSpeed;
     this.MinSpeed         = MinSpeed;
     this.JumpStrength     = JumpStrength;
     this.GravityStrength  = GravityStrength;
     this.Acceleration     = Acceleration;
     this.Decceleration    = Decceleration;
     this.AirAcceleration  = AirAcceleration;
     this.AirDecceleration = AirDecceleration;
     MaxVelocityScaler     = 1f;
     DeccelerationScaler   = 1f;
     AccelerationScaler    = 1f;
     JumpStrengthScaler    = 1f;
     VelocityScaler        = Vector3.One;
     hitGroundBehavior     = HGB;
 }
예제 #2
0
        public float GetFaceIntersectDistance(BackingBox Box2, Face ContactFace)
        {
            switch (ContactFace)
            {
            case Face.Left:
                return(Right - Box2.Left);

            case Face.Right:
                return(Box2.Right - Left);

            case Face.Bottom:
                return(Top - Box2.Bottom);

            case Face.Top:
                if (Box2.B.isRamp)
                {
                    return((Box2.Front - Back) * (Box2.Height / Box2.Depth) - (Bottom - Box2.Bottom));
                }
                return(Box2.Top - Bottom);

            case Face.Back:
                return(Front - Box2.Back);

            case Face.Front:
                return(Box2.Front - Back);

            default:
                return(0);
            }
        }
예제 #3
0
 public BulletMovement(BackingBox BackingBox, Vector3 Velocity, bool IsGravityEnabled = false)
 {
     this.BackingBox       = BackingBox;
     this.Velocity         = Velocity;
     this.IsGravityEnabled = IsGravityEnabled;
     World.GetWorldFromCurrentLevel().AddBox(this.BackingBox);
 }
예제 #4
0
 public bool DoesProjectionOverlapOther(BackingBox Other)
 {
     if (this == Dummy || Other == Dummy)
     {
         return(true);
     }
     return(B.Projection.Intersects(Other.B.Projection));
 }
예제 #5
0
        public static BackingBox Build(IType InteractionType, Box B, SortingMode SortMode = SortingMode.Box)
        {
            BackingBox b = boxPool.Rent();

            b.InteractionType = InteractionType;
            b.B        = B;
            b.SortMode = SortMode;
            return(b);
        }
예제 #6
0
        public static BackingBox Build(IType InteractionType, float X, float Y, float Z, float Width, float Height, float Depth, bool IsTriangle = false, bool IsRamp = false, SortingMode SortMode = SortingMode.Front)
        {
            BackingBox b = boxPool.Rent();

            b.InteractionType = InteractionType;
            b.B        = new Box(X, Y, Z, Width, Height, Depth, IsTriangle, IsRamp);
            b.SortMode = SortMode;
            return(b);
        }
예제 #7
0
 public int Compare(BackingBox OtherBox)
 {
     if (this == OtherBox)
     {
         return(0);
     }
     if (this == Dummy)
     {
         return(1);
     }
     else if (OtherBox == Dummy)
     {
         return(-1);
     }
     return(B.Compare(OtherBox.B));
 }
예제 #8
0
        public void MatchFace(BackingBox Box2, Face ContactFace, Vector3?Offset = null)
        {
            float x = X;
            float y = Y;
            float z = Z;

            switch (ContactFace)
            {
            case Face.Left:
                x = Box2.Left - Width;
                break;

            case Face.Right:
                x = Box2.Right;
                break;

            case Face.Bottom:
                y = Box2.Bottom - Height;
                break;

            case Face.Top:
                if (Box2.B.isRamp)
                {
                    y = (Box2.Front - Back) * (Box2.Height / Box2.Depth) + Box2.Bottom;
                }
                else
                {
                    y = Box2.Top;
                }
                break;

            case Face.Back:
                z = Box2.Back - Depth;
                break;

            case Face.Front:
                z = Box2.Front;
                break;
            }
            Vector3 offset = Offset.HasValue ? Offset.Value : Vector3.Zero;

            Teleport(new Vector3(x, y, z) + offset);
        }
예제 #9
0
 public static PlatformMovement GetStaticPlatformMovement(BackingBox B, HitGroundBehavior HGB = HitGroundBehavior.None)
 {
     return(new PlatformMovement(B, new StaticPlatformInputHandler(), 1000, 30, 0, 1000, 0, 3000, 0, 0, HGB));
 }
예제 #10
0
 public static void Return(BackingBox B)
 {
     boxPool.Return(B);
 }