コード例 #1
0
ファイル: ProtoDrone.cs プロジェクト: jashking/CryoFall
        protected virtual void ServerExecuteVehicleExplosion(
            Vector2D positionEpicenter,
            IPhysicsSpace physicsSpace,
            WeaponFinalCache weaponFinalCache)
        {
            WeaponExplosionSystem.ServerProcessExplosionCircle(
                positionEpicenter: positionEpicenter,
                physicsSpace: physicsSpace,
                damageDistanceMax: this.DestroyedVehicleDamageRadius,
                weaponFinalCache: weaponFinalCache,
                damageOnlyDynamicObjects: false,
                isDamageThroughObstacles: false,
                callbackCalculateDamageCoefByDistanceForStaticObjects: CalcDamageCoefByDistance,
                callbackCalculateDamageCoefByDistanceForDynamicObjects: CalcDamageCoefByDistance);

            double CalcDamageCoefByDistance(double distance)
            {
                var distanceThreshold = 0.5;

                if (distance <= distanceThreshold)
                {
                    return(1);
                }

                distance -= distanceThreshold;
                distance  = Math.Max(0, distance);

                var maxDistance = this.DestroyedVehicleDamageRadius;

                maxDistance -= distanceThreshold;
                maxDistance  = Math.Max(0, maxDistance);

                return(1 - Math.Min(distance / maxDistance, 1));
            }
        }
コード例 #2
0
 protected virtual void ServerExecuteExplosion(
     Vector2D positionEpicenter,
     IPhysicsSpace physicsSpace,
     WeaponFinalCache weaponFinalCache)
 {
     WeaponExplosionSystem.ServerProcessExplosionCircle(
         positionEpicenter: positionEpicenter,
         physicsSpace: physicsSpace,
         damageDistanceMax: this.DamageRadius,
         weaponFinalCache: weaponFinalCache,
         damageOnlyDynamicObjects: false,
         callbackCalculateDamageCoefByDistance: this.ServerCalculateDamageCoefByDistance);
 }
コード例 #3
0
 public override void ServerExecuteExplosion(
     Vector2D positionEpicenter,
     IPhysicsSpace physicsSpace,
     WeaponFinalCache weaponFinalCache)
 {
     WeaponExplosionSystem.ServerProcessExplosionCircle(
         positionEpicenter: positionEpicenter,
         physicsSpace: physicsSpace,
         damageDistanceMax: this.DamageRadius,
         weaponFinalCache: weaponFinalCache,
         damageOnlyDynamicObjects: true,
         isDamageThroughObstacles: this.IsDamageThroughObstacles,
         callbackCalculateDamageCoefByDistanceForStaticObjects:
         this.ServerCalculateDamageCoefByDistanceForStaticObjects,
         callbackCalculateDamageCoefByDistanceForDynamicObjects: this
         .ServerCalculateDamageCoefByDistanceForDynamicObjects,
         // Missiles are falling from the sky and the explosion circles are clearly designated.
         // Players expecting that they will be not damaged when they stand outside the circles.
         collisionGroups: new[] { CollisionGroup.Default });
 }
コード例 #4
0
        public override void ServerExecuteExplosion(
            Vector2D positionEpicenter,
            IPhysicsSpace physicsSpace,
            WeaponFinalCache weaponFinalCache)
        {
            WeaponExplosionSystem.ServerProcessExplosionCircle(
                positionEpicenter: positionEpicenter,
                physicsSpace: physicsSpace,
                damageDistanceMax: this.DamageRadius,
                weaponFinalCache: weaponFinalCache,
                damageOnlyDynamicObjects: true,
                isDamageThroughObstacles: this.IsDamageThroughObstacles,
                callbackCalculateDamageCoefByDistanceForStaticObjects:
                this.ServerCalculateDamageCoefByDistanceForStaticObjects,
                callbackCalculateDamageCoefByDistanceForDynamicObjects: this
                .ServerCalculateDamageCoefByDistanceForDynamicObjects,
                // Missiles are falling from the sky and the explosion circles are clearly designated.
                // Players are expecting that they will be not damaged when they stand outside the circles.
                collisionGroups: new[] { CollisionGroups.Default });

            // this is only for hoverboards as hoverboards on the ground have no physical collider
            WeaponExplosionSystem.ServerProcessExplosionCircle(
                positionEpicenter: positionEpicenter,
                physicsSpace: physicsSpace,
                damageDistanceMax: this.DamageRadius,
                weaponFinalCache: weaponFinalCache,
                damageOnlyDynamicObjects: true,
                isDamageThroughObstacles: this.IsDamageThroughObstacles,
                callbackCalculateDamageCoefByDistanceForStaticObjects:
                this.ServerCalculateDamageCoefByDistanceForStaticObjects,
                callbackCalculateDamageCoefByDistanceForDynamicObjects: this
                .ServerCalculateDamageCoefByDistanceForDynamicObjects,
                // this is only for hoverboards
                collisionGroups: new[] { CollisionGroups.HitboxMelee },
                // can damage only hoverboards
                filterCanDamage: worldObject => worldObject.ProtoGameObject is IProtoVehicleHoverboard);
        }