private void Bite(Destroible ipl) { move = false; tiltTm = 0; if (zombieBite > 1) { zombieBite = 0; PlayRandSound(screamSounds); ipl.RPCSetLifeLocal(ipl.Life - (Math.Min(_Game.mapSettings.zombieDamage, _Game.stage + 1) * (zombieType == ZombieType.Life ? 3 : 1)), -1); } }
protected virtual void ExplodeOnHit(RaycastHit hit) { var g = hit.collider.gameObject; var t = hit.collider.transform; transform.position = hit.point + transform.rotation * Vector3.forward; bool glass = g.tag == "glass"; var m = t.GetMonoBehaviorInParrent(); if (!explodeOnDestroy) { var r = hit.rigidbody; var rt = transform.rotation; if (r != null && r.velocity.magnitude < 20 && r.gameObject.GetComponent <Player>() == null) { r.AddForceAtPosition(rt * new Vector3(0, 0, ExpForce * hit.rigidbody.mass / hit.collider.bounds.size.magnitude * 1000) * fdt, hit.point); } } Destroible destroible = m as Destroible; if (g.layer == LayerMask.NameToLayer("Level") || g.layer == LayerMask.NameToLayer("Glass")) { _Game.AddDecal(glass ? DecalTypes.glass : (decalhole ? DecalTypes.Hole : DecalTypes.Decal), hit.point - rot * Vector3.forward * 0.12f, hit.normal, t); } if (destroible is Zombie && _SettingsWindow.Blood) { _Game.particles[(int)ParticleTypes.BloodSplatters].Emit(hit.point, transform.rotation); RaycastHit h; if (Physics.Raycast(new Ray(pos, new Vector3(0, -1, 0)), out h, 10, 1 << LayerMask.NameToLayer("Level") | LayerMask.NameToLayer("MapItem"))) { _Game.AddDecal( DecalTypes.Blood, h.point - new Vector3(0, -1, 0) * 0.1f, h.normal, _Game.decals.transform); } } else { _Game.particles[(int)ParticleTypes.particle_metal].Emit(hit.point, transform.rotation); } if (destroible != null && destroible.isController && destroible.Alive) { destroible.RPCSetLifeLocal(destroible.Life - damage * damageFactor(destroible), OwnerID); } bool staticfield = g.name.ToLower().StartsWith("staticfield"); if (staticfield) { Force = Quaternion.LookRotation(hit.point - g.transform.position) * Vector3.forward * Force.magnitude; } if (!glass && !staticfield) { probivaemost--; if (explodeOnDestroy) { Explode(hit.point); } } if (probivaemost < 0) { Destroy(gameObject); } }
private void Bite(Destroible ipl) { move = false; tiltTm = 0; if (zombieBite > 1) { zombieBite = 0; PlayRandSound(screamSounds); ipl.RPCSetLifeLocal(ipl.Life - (Math.Min(_Game.mapSettings.zombieDamage, _Game.stage + 1) * (zombieType == ZombieType.Life ? 3 : 1)), -1); } }