Beispiel #1
0
        // Token: 0x060033E8 RID: 13288 RVA: 0x00152238 File Offset: 0x00150638
        public static RaycastInfo raycast(Ray ray, float range, int mask)
        {
            RaycastHit hit;

            PhysicsUtility.raycast(ray, out hit, range, mask, QueryTriggerInteraction.UseGlobal);
            RaycastInfo raycastInfo = new RaycastInfo(hit);

            raycastInfo.direction = ray.direction;
            if (hit.transform != null)
            {
                if (hit.transform.CompareTag("Enemy"))
                {
                    raycastInfo.player = DamageTool.getPlayer(raycastInfo.transform);
                }
                if (hit.transform.CompareTag("Zombie"))
                {
                    raycastInfo.zombie = DamageTool.getZombie(raycastInfo.transform);
                }
                if (hit.transform.CompareTag("Animal"))
                {
                    raycastInfo.animal = DamageTool.getAnimal(raycastInfo.transform);
                }
                raycastInfo.limb = DamageTool.getLimb(raycastInfo.transform);
                if (hit.transform.CompareTag("Vehicle"))
                {
                    raycastInfo.vehicle = DamageTool.getVehicle(raycastInfo.transform);
                }
                if (raycastInfo.zombie != null && raycastInfo.zombie.isRadioactive)
                {
                    raycastInfo.material = EPhysicsMaterial.ALIEN_DYNAMIC;
                }
                else
                {
                    raycastInfo.material = DamageTool.getMaterial(hit.point, hit.transform, hit.collider);
                }
            }
            return(raycastInfo);
        }
Beispiel #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (Provider.isServer)
     {
         if (other.isTrigger)
         {
             return;
         }
         if (other.CompareTag("Debris"))
         {
             return;
         }
         float num = Mathf.Clamp(this.vehicle.speed * this.vehicle.asset.bumperMultiplier, 0f, 10f);
         if (num < 3f)
         {
             return;
         }
         if (other.transform.parent.CompareTag("Vehicle"))
         {
             return;
         }
         if (other.transform.CompareTag("Player"))
         {
             if (Provider.isPvP && this.vehicle.isDriven)
             {
                 Player player = DamageTool.getPlayer(other.transform);
                 if (player != null && player.movement.getVehicle() == null && !this.vehicle.passengers[0].player.player.quests.isMemberOfSameGroupAs(player))
                 {
                     EPlayerKill eplayerKill;
                     DamageTool.damage(player, EDeathCause.ROADKILL, ELimb.SPINE, this.vehicle.passengers[0].player.playerID.steamID, base.transform.forward, Bumper.DAMAGE_PLAYER, num, out eplayerKill);
                     EffectManager.sendEffect(5, EffectManager.SMALL, other.transform.position + other.transform.up, -base.transform.forward);
                     this.vehicle.askDamage(2, true);
                 }
             }
         }
         else if (other.transform.CompareTag("Agent"))
         {
             Zombie zombie = DamageTool.getZombie(other.transform);
             if (zombie != null)
             {
                 EPlayerKill eplayerKill2;
                 uint        num2;
                 DamageTool.damage(zombie, base.transform.forward, Bumper.DAMAGE_ZOMBIE, num, out eplayerKill2, out num2);
                 EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, other.transform.position + other.transform.up, -base.transform.forward);
                 this.vehicle.askDamage(2, true);
             }
             else
             {
                 Animal animal = DamageTool.getAnimal(other.transform);
                 if (animal != null)
                 {
                     EPlayerKill eplayerKill3;
                     uint        num3;
                     DamageTool.damage(animal, base.transform.forward, Bumper.DAMAGE_ANIMAL, num, out eplayerKill3, out num3);
                     EffectManager.sendEffect(5, EffectManager.SMALL, other.transform.position + other.transform.up, -base.transform.forward);
                     this.vehicle.askDamage(2, true);
                 }
             }
         }
         else
         {
             if (!other.transform.CompareTag("Barricade"))
             {
                 if (!other.transform.CompareTag("Structure"))
                 {
                     if (other.transform.CompareTag("Resource"))
                     {
                         DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true);
                         EPlayerKill eplayerKill4;
                         uint        num4;
                         ResourceManager.damage(other.transform, base.transform.forward, Bumper.DAMAGE_RESOURCE, num, 1f, out eplayerKill4, out num4);
                         this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true);
                     }
                     else
                     {
                         InteractableObjectRubble componentInParent = other.transform.GetComponentInParent <InteractableObjectRubble>();
                         if (componentInParent != null)
                         {
                             EPlayerKill eplayerKill5;
                             uint        num5;
                             DamageTool.damage(componentInParent.transform, base.transform.forward, componentInParent.getSection(other.transform), Bumper.DAMAGE_OBJECT, num, out eplayerKill5, out num5);
                             if (Time.realtimeSinceStartup - this.lastDamageImpact > 0.2f)
                             {
                                 this.lastDamageImpact = Time.realtimeSinceStartup;
                                 DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true);
                                 this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true);
                             }
                         }
                         else if (Time.realtimeSinceStartup - this.lastDamageImpact > 0.2f)
                         {
                             ObjectAsset asset = LevelObjects.getAsset(other.transform);
                             if (asset != null && !asset.isSoft)
                             {
                                 this.lastDamageImpact = Time.realtimeSinceStartup;
                                 DamageTool.impact(base.transform.position + base.transform.forward * ((BoxCollider)base.transform.GetComponent <Collider>()).size.z / 2f, -base.transform.forward, DamageTool.getMaterial(base.transform.position, other.transform, other.GetComponent <Collider>()), true);
                                 this.vehicle.askDamage((ushort)(Bumper.DAMAGE_VEHICLE * num), true);
                             }
                         }
                     }
                 }
             }
             if (!this.vehicle.isDead && !other.transform.CompareTag("Border") && ((this.vehicle.asset.engine == EEngine.PLANE && this.vehicle.speed > 20f) || (this.vehicle.asset.engine == EEngine.HELICOPTER && this.vehicle.speed > 10f)))
             {
                 this.vehicle.askDamage(20000, false);
             }
         }
     }
 }
Beispiel #3
0
 // Token: 0x06002219 RID: 8729 RVA: 0x000BB8A8 File Offset: 0x000B9CA8
 private void OnTriggerEnter(Collider other)
 {
     if (other.isTrigger)
     {
         return;
     }
     if (Time.realtimeSinceStartup - this.lastActive < 0.25f)
     {
         return;
     }
     if (other.transform == base.transform.parent)
     {
         return;
     }
     if (Provider.isServer)
     {
         if (this.isExplosive)
         {
             if (other.transform.CompareTag("Player"))
             {
                 if (Provider.isPvP && !other.transform.parent.CompareTag("Vehicle"))
                 {
                     EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position);
                     List <EPlayerKill> list;
                     DamageTool.explode(base.transform.position, this.range2, EDeathCause.LANDMINE, CSteamID.Nil, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list, EExplosionDamageType.CONVENTIONAL, 32f, true, false);
                 }
             }
             else
             {
                 EffectManager.sendEffect(this.explosion2, EffectManager.LARGE, base.transform.position);
                 List <EPlayerKill> list2;
                 DamageTool.explode(base.transform.position, this.range2, EDeathCause.LANDMINE, CSteamID.Nil, this.playerDamage, this.zombieDamage, this.animalDamage, this.barricadeDamage, this.structureDamage, this.vehicleDamage, this.resourceDamage, this.objectDamage, out list2, EExplosionDamageType.CONVENTIONAL, 32f, true, false);
             }
         }
         else if (other.transform.CompareTag("Player"))
         {
             if (Provider.isPvP && !other.transform.parent.CompareTag("Vehicle"))
             {
                 Player player = DamageTool.getPlayer(other.transform);
                 if (player != null)
                 {
                     EPlayerKill eplayerKill;
                     DamageTool.damage(player, EDeathCause.SHRED, ELimb.SPINE, CSteamID.Nil, Vector3.up, this.playerDamage, 1f, out eplayerKill);
                     if (this.isBroken)
                     {
                         player.life.breakLegs();
                     }
                     EffectManager.sendEffect(5, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down);
                     BarricadeManager.damage(base.transform.parent, 5f, 1f, false);
                 }
             }
         }
         else if (other.transform.CompareTag("Agent"))
         {
             Zombie zombie = DamageTool.getZombie(other.transform);
             if (zombie != null)
             {
                 EPlayerKill eplayerKill2;
                 uint        num;
                 DamageTool.damage(zombie, base.transform.forward, this.zombieDamage, 1f, out eplayerKill2, out num);
                 EffectManager.sendEffect((!zombie.isRadioactive) ? 5 : 95, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down);
                 BarricadeManager.damage(base.transform.parent, (!zombie.isHyper) ? 5f : 10f, 1f, false);
             }
             else
             {
                 Animal animal = DamageTool.getAnimal(other.transform);
                 if (animal != null)
                 {
                     EPlayerKill eplayerKill3;
                     uint        num2;
                     DamageTool.damage(animal, base.transform.forward, this.animalDamage, 1f, out eplayerKill3, out num2);
                     EffectManager.sendEffect(5, EffectManager.SMALL, base.transform.position + Vector3.up, Vector3.down);
                     BarricadeManager.damage(base.transform.parent, 5f, 1f, false);
                 }
             }
         }
     }
 }