protected override void SharedProcessCreatedPhysics(CreatePhysicsData data)
 {
     // inherit physics
     this.protoPragmiumSource.Value.SharedCreatePhysics(data.GameObject);
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     // this is decorative prop, no physics
 }
Exemple #3
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (0.85, 0.75));
     AddFullHeightWallHitboxes(data, width: 0.85, offsetY: -0.15);
 }
Exemple #4
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeCircle(radius: 0.2, center: (0.5, 0.35))
     .AddShapeCircle(radius: 0.2, center: (0.5, 0.35), group: CollisionGroups.HitboxMelee);
 }
Exemple #5
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     // do not create any physic shapes for spectator characters
     //base.CreatePhysics(data);
     data.PhysicsBody.Friction = this.PhysicsBodyFriction;
 }
Exemple #6
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     AddRectangleWithHitboxes(data, size: (2, 2));
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (1.8, 1.1), offset: (0.1, 0.2));
     AddHalfHeightWallHitboxes(data, width: 1.8, offsetX: 0.1, offsetY: 0.2);
 }
Exemple #8
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (2.2, 1.6), offset: (0.7, 0.1))
     .AddShapeRectangle(size: (0.6, 1.1), offset: (0.1, 0.1));
 }
Exemple #9
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (2.9, 1.6), offset: (0, 0.1));
     AddFullHeightWallHitboxes(data, width: 2.8, offsetX: 0.1);
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (0.7, 1), offset: (0.15, 0));
     AddFullHeightWallHitboxes(data);
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody.AddShapeRectangle((1, 1));
 }
Exemple #12
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (0.9, 1.17), offset: (0.05, 0), group: CollisionGroups.ClickArea);
 }
Exemple #13
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     AddRectangleWithHitboxes(data, size: (0.9, 1), offset: (0, 0));
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeCircle(radius: 0.45, center: (1.0, 0.7))
     .AddShapeCircle(radius: 0.4, center: (0.9, 1.25));
 }
Exemple #15
0
 protected abstract void SharedCreatePhysics(CreatePhysicsData data);
Exemple #16
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     AddRectangleWithHitboxes(data, size: (1.6, 2.0), offset: (0, 0));
     AddRectangleWithHitboxes(data, size: (1.2, 1.0), offset: (0.4, 2));
 }
Exemple #17
0
 protected virtual void SharedProcessCreatedPhysics(CreatePhysicsData data)
 {
 }
Exemple #18
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (1, 0.65));
     AddFullHeightWallHitboxes(data);
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     // no physics
 }
 protected override void SharedProcessCreatedPhysics(CreatePhysicsData data)
 {
 }
Exemple #21
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (1, 0.5), offset: (0, 0));
     AddHalfHeightWallHitboxes(data);
 }
Exemple #22
0
 protected sealed override void SharedCreatePhysics(CreatePhysicsData data)
 {
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     // do not create any physics for spectator characters
     //base.CreatePhysics(data);
 }
Exemple #24
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (0.8, 0.5), offset: (0.1, 0.1))
     .AddShapeRectangle(size: (0.8, 0.6), offset: (0.1, 0.2), group: CollisionGroups.HitboxMelee);
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle((1, 2), null);
     AddHalfHeightWallHitboxes(data);
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (2, 0.9));
     AddHalfHeightWallHitboxes(data, width: 2);
 }
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     // implemented in concrete classes
 }
Exemple #28
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (0.7, 0.75), offset: (0.15, 0.25));
 }
Exemple #29
0
 protected override void SharedCreatePhysics(CreatePhysicsData data)
 {
     data.PhysicsBody
     .AddShapeRectangle(size: (1, 2), offset: (0, 0));
 }
Exemple #30
0
        protected override void SharedCreatePhysics(CreatePhysicsData data)
        {
            var publicState = GetPublicState(data.GameObject);

            if (publicState.IsDead)
            {
                // do not create any physics for dead character
                return;
            }

            var physicsBody    = data.PhysicsBody;
            var currentVehicle = publicState.CurrentVehicle;
            var protoVehicle   = currentVehicle?.ProtoGameObject as IProtoVehicle;

            if (protoVehicle is not null)
            {
                protoVehicle.SharedGetSkeletonProto(currentVehicle, out var skeleton, out _);
                if (skeleton is not null)
                {
                    // do not create any physics for a character in vehicle (vehicle has its own physics)
                    physicsBody.AttachedToPhysicsBody = currentVehicle.PhysicsBody;
                    // but ensure the physics body is enabled even if it doesn't have physics shapes)
                    physicsBody.IsEnabled = true;
                    return;
                }
            }

            base.SharedCreatePhysics(data);

            // add interaction area
            var characterInteractionRadius = InteractionRadius;

            if (IsServer)
            {
                // allow a little bigger interaction area on server
                // (because the client position could differ from server position with some threshold)
                characterInteractionRadius += 2
                                              * ClientCurrentCharacterLagPredictionManager
                                              .MaxPredictionErrorDistanceToInterpolateWhenStaying;

                // increase the interaction radius a bit to counter
                // the networked positions quantization due to coordinate packing
                // (in tile position is encoded as 0-255 (byte.MaxValue) for each axis)
                characterInteractionRadius += 1 / 255.0;
            }

            if (protoVehicle is null)
            {
                physicsBody.AddShapeCircle(
                    center: (0, 0.65),
                    radius: characterInteractionRadius,
                    group: CollisionGroups.CharacterInteractionArea);
                physicsBody.UseInstantVelocityDirectionChange = true;
            }
            else // has a vehicle
            {
                physicsBody.RemoveShapesOfGroup(CollisionGroups.Default);
                if (!ReferenceEquals(CollisionGroups.Default,
                                     CollisionGroups.CharacterOrVehicle))
                {
                    physicsBody.RemoveShapesOfGroup(CollisionGroups.CharacterOrVehicle);
                }

                physicsBody.AttachedToPhysicsBody = currentVehicle.PhysicsBody;
            }
        }