示例#1
0
    public void Reset()
    {
        left  = points[0].x;
        right = points[0].x;
        up    = points[0].y;
        down  = points[0].y;

        for (int i = 0; i < points.Length; i++)
        {
            if (this[i].x < left)
            {
                left = this[i].x;
            }
            if (this[i].x > right)
            {
                right = this[i].x;
            }
            if (this[i].y < down)
            {
                down = this[i].y;
            }
            if (this[i].y > up)
            {
                up = this[i].y;
            }
        }

        width  = FixedMath.Max(FixedMath.Abs(left), FixedMath.Abs(right)) * 2;
        height = FixedMath.Max(FixedMath.Abs(down), FixedMath.Abs(up)) * 2;
    }
        public override void Execute()
        {
            LogicEntity e = Contexts.sharedInstance.logic.GetEntityWithId(entityID);

            if (e.velocity.value.y > minJump && !e.isGrounded)
            {
                e.ReplaceVelocity(e.velocity.value.SetY(FixedMath.Max(e.velocity.value.y - (maxJump - minJump), minJump)));
            }
        }
示例#3
0
        public void CalculateRaySpacing(BoundingBox box)
        {
            horizontalRayCount = FixedMath.RoundToInt(box.height.Div(raySpacing));
            verticalRayCount   = FixedMath.RoundToInt(box.width.Div(raySpacing));

            horizontalRayCount = (int)FixedMath.Max(horizontalRayCount, 2);
            verticalRayCount   = (int)FixedMath.Max(verticalRayCount, 2);

            horizontalRaySpacing = box.height / (horizontalRayCount - 1);
            verticalRaySpacing   = box.width / (verticalRayCount - 1);
        }