public void LocalizedHit(LocalizedHitData data) { if (!PlayerPreferences.NoDestruction) { if (BoltNetwork.isClient) { if (this._owner) { FoundationArchitect foundation = this._owner._foundation; if (foundation) { FoundationExLocalizedHit foundationExLocalizedHit = FoundationExLocalizedHit.Create(GlobalTargets.OnlyServer); foundationExLocalizedHit.Entity = base.GetComponentInParent <BoltEntity>(); foundationExLocalizedHit.Chunk = foundation.GetChunkIndex(this); foundationExLocalizedHit.HitDamage = data._damage; foundationExLocalizedHit.HitPosition = data._position; foundationExLocalizedHit.Send(); Prefabs.Instance.SpawnHitPS(HitParticles.Wood, data._position, Quaternion.LookRotation(base.transform.right)); this._owner.Distort(data); } } } else { this.LocalizedHitReal(data); } } }
public void LocalizedHitReal(LocalizedHitData data) { if (this._owner) { this._owner.LocalizedTierHit(data, this); } }
public void LocalizedHit(LocalizedHitData data) { if (BoltNetwork.isClient) { if (this._owner) { FoundationArchitect foundation = this._owner._foundation; if (foundation) { FoundationExLocalizedHit foundationExLocalizedHit = FoundationExLocalizedHit.Create(GlobalTargets.OnlyServer); foundationExLocalizedHit.Entity = base.GetComponentInParent<BoltEntity>(); foundationExLocalizedHit.Chunk = foundation.GetChunkIndex(this); foundationExLocalizedHit.HitDamage = data._damage; foundationExLocalizedHit.HitPosition = data._position; foundationExLocalizedHit.Send(); Prefabs.Instance.SpawnWoodHitPS(data._position, Quaternion.LookRotation(base.transform.right)); this._owner.Distort(data); } } } else { this.LocalizedHitReal(data); } }
public static void Prefix(ref LocalizedHitData data) { if (Menu.InstantDestory) { data._damage = 100000f; } }
public void LocalizedHit(LocalizedHitData data) { if (this._nextHit < Time.realtimeSinceStartup) { this._nextHit = Time.realtimeSinceStartup + 0.5f; if (BoltNetwork.isRunning) { LocalizedHit localizedHit = global::LocalizedHit.Create(GlobalTargets.OnlyServer); localizedHit.Damage = data._damage; localizedHit.Position = data._position; localizedHit.Building = this.entity; if (base.transform.parent) { localizedHit.Chunk = this._bh.GetChunkIndex(this); } else { localizedHit.Chunk = -1; } localizedHit.Send(); if (BoltNetwork.isClient) { Prefabs.Instance.SpawnWoodHitPS(data._position, Quaternion.LookRotation(base.transform.right)); this.DistortReal(data); } } else { this.LocalizedHitReal(data); } } }
private void DistortRandom() { if (this._chunks.Length <= 0) { if (this._mpRandomDistortColliders != null && this._mpRandomDistortColliders.Length > 0) { Collider collider = this._mpRandomDistortColliders[UnityEngine.Random.Range(0, this._mpRandomDistortColliders.Length)]; Vector3 vector = default(Vector3); if (collider is BoxCollider) { vector = BuildingHealth.GetPointInCollider(collider as BoxCollider); } if (collider is SphereCollider) { vector = BuildingHealth.GetPointInCollider(collider as SphereCollider); } if (vector != Vector3.zero) { LocalizedHitData data = default(LocalizedHitData); float num = (1f - this.Hp / this._maxHP) / (float)base.state.BuildingHits; data._damage = num * this._maxHP; data._position = vector; data._distortRatio = num * 50f; this.DistortReal(data); } } } }
private void DistortReal(LocalizedHitData data) { if (data._damage > 0f) { Renderer[] array = null; if (this._renderersRoot) { LOD_GroupToggle component = this._renderersRoot.GetComponent <LOD_GroupToggle>(); if (component && component._levels != null && component._levels.Length > 0) { array = component._levels[0].Renderers; } } if (array == null) { array = ((!(this._renderersRoot != null)) ? base.gameObject : this._renderersRoot).GetComponentsInChildren <Renderer>(); } float num = Mathf.Clamp(data._damage * data._distortRatio * 10f / this._maxHP, 1f, Mathf.Lerp(2f, 10f, (this._maxHP - 100f) / 400f)); for (int i = 0; i < array.Length; i++) { if (array[i] && array[i].enabled) { Transform transform = array[i].transform; GameObject gameObject = transform.gameObject; float num2 = Vector3.Distance(array[i].bounds.center, data._position); if (num2 < 12f) { float num3 = (1f - num2 / 12f) * num; transform.localRotation *= Quaternion.Euler((float)UnityEngine.Random.Range(-1, 1) * num3, (float)UnityEngine.Random.Range(-1, 1) * num3, (float)UnityEngine.Random.Range(-1, 1) * num3); } } } } }
public static LocalizedHitData GetLocalizedHitData(LocalizedHitData data) { if (!UCheatmenu.DestroyBuildings) { return(data); } return(new LocalizedHitData(data._position, 100000f)); }
public static LocalizedHitData GetLocalizedHitData(LocalizedHitData data) { if (!removeBuild.removeBuildings) { return(data); } return(new LocalizedHitData(data._position, 100000f)); }
public void LocalizedHit(LocalizedHitData data) { BuildingHealth buildingHealth = this.GetBuildingHealth(); if (buildingHealth) { buildingHealth.LocalizedHit(data); } }
public void LocalizedHit(LocalizedHitData data) { BuildingHealthChunk componentInParent = base.transform.GetComponentInParent <BuildingHealthChunk>(); if (componentInParent) { componentInParent.LocalizedHit(data); } }
public override void OnEvent(FoundationExLocalizedHit evnt) { if (evnt.Entity) { LocalizedHitData data = default(LocalizedHitData); data._damage = evnt.HitDamage; data._position = evnt.HitPosition; evnt.Entity.GetComponent <FoundationArchitect>().GetChunk(evnt.Chunk).LocalizedHitReal(data); } }
private void Distort(LocalizedHitData data) { if (BoltNetwork.isRunning) { base.state.BuildingHits++; } else { this.DistortReal(data); } }
public void LocalizedHitReal(LocalizedHitData data) { if (!PlayerPreferences.NoDestruction && this.HpActual > 0f) { Prefabs.Instance.SpawnHitPS(this._particleType, data._position, Quaternion.LookRotation(data._position - base.transform.position)); this.DamageOnly(data, 0); if (this.HpActual > 0f) { this.Distort(data); } } }
public void LocalizedHit(LocalizedHitData data) { PrefabIdentifier componentInParent = base.transform.GetComponentInParent <PrefabIdentifier>(); if (componentInParent) { BuildingHealth component = componentInParent.GetComponent <BuildingHealth>(); if (component) { component.LocalizedHit(data); } } }
private void Distort(LocalizedHitData data) { if (BoltNetwork.isRunning) { int chunkIndex = this._bh.GetChunkIndex(this); NetworkArray_Integer chunkHits; int index; (chunkHits = base.state.ChunkHits)[index = chunkIndex] = chunkHits[index] + 1; } else { this.DistortReal(data); } }
private void LocalizedHit(LocalizedHitData data) { if (!this._idleIfPresent) { Prefabs.Instance.SpawnWoodHitPS(data._position, Quaternion.LookRotation(base.transform.position - data._position)); if (this._hp > 0f) { this._hp -= data._damage; if (this._hp <= 0f) { this.lookAtExplosion(base.transform.position); } } } }
private void DistortReal(LocalizedHitData data) { Renderer[] componentsInChildren = base.transform.GetComponentsInChildren <Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i].enabled) { Transform transform = componentsInChildren[i].transform; GameObject gameObject = transform.gameObject; if (Vector3.Distance(transform.position, data._position) < 4f) { transform.localRotation *= Quaternion.Euler((float)UnityEngine.Random.Range(-1, 1), (float)UnityEngine.Random.Range(-1, 1), (float)UnityEngine.Random.Range(-1, 1)); } } } }
private void Distort(LocalizedHitData data) { if (BoltNetwork.isRunning) { int chunkIndex = this._bh.GetChunkIndex(this); NetworkArray_Integer chunkHits; NetworkArray_Values <int> expr_22 = chunkHits = base.state.ChunkHits; int num; int expr_25 = num = chunkIndex; num = chunkHits[num]; expr_22[expr_25] = num + 1; } else { this.DistortReal(data); } }
private void DistortRenderers(LocalizedHitData data, Renderer[] rs) { float num = Mathf.Clamp(data._damage * data._distortRatio * 10f / (this._chunkTierHP + (float)this._bonusHp), 1f, 10f); for (int i = 0; i < rs.Length; i++) { if (rs[i].enabled) { Transform transform = rs[i].transform; GameObject gameObject = transform.gameObject; if (Vector3.Distance(rs[i].bounds.center, data._position) < 12f) { transform.localRotation *= Quaternion.Euler(UnityEngine.Random.Range(-0.6f, 0.6f) * num, UnityEngine.Random.Range(-0.6f, 0.6f) * num, UnityEngine.Random.Range(-0.6f, 0.6f) * num); } } } }
public void Distort(LocalizedHitData data) { if (data._damage > 0f) { Renderer[] componentsInChildren = this._foundation.FoundationRoot.GetComponentsInChildren <Renderer>(); this.DistortRenderers(data, componentsInChildren); if (this._foundation._mode == FoundationArchitect.Modes.ManualSlave) { FloorArchitect component = base.GetComponent <FloorArchitect>(); if (component) { componentsInChildren = component.FloorRoot.GetComponentsInChildren <Renderer>(); this.DistortRenderers(data, componentsInChildren); } } } }
public override void OnEvent(LocalizedHit evnt) { if (evnt.Building) { LocalizedHitData data = default(LocalizedHitData); data._damage = evnt.Damage; data._position = evnt.Position; if (evnt.Chunk == -1) { evnt.Building.GetComponent <BuildingHealth>().LocalizedHitReal(data); } else { evnt.Building.GetComponent <BuildingHealth>().GetChunk(evnt.Chunk).LocalizedHitReal(data); } } }
private void LocalizedHit(LocalizedHitData data) { if (!this._idleIfPresent) { if (BoltNetwork.isRunning) { CoopTreeId coopTreeId = base.GetComponentInParent <CoopTreeId>(); if (!coopTreeId) { TreeHealth componentInParent = base.GetComponentInParent <TreeHealth>(); if (componentInParent && componentInParent.LodTree) { coopTreeId = componentInParent.LodTree.GetComponent <CoopTreeId>(); } } if (coopTreeId && coopTreeId.state.State != 3) { return; } } else if (this._tree) { if (this._tree.Health > 0) { return; } } else if (this._coolDown != 0f) { return; } Prefabs.Instance.SpawnHitPS(HitParticles.Wood, data._position, Quaternion.LookRotation(base.transform.position - data._position)); if (this._hp > 0f) { this._hp -= data._damage; if (this._hp <= 0f) { this.lookAtExplosion(base.transform.position); } } } }
public void LocalizedHit(LocalizedHitData data) { if (this.LastHitTime + 0.5f < Time.realtimeSinceStartup) { this.LastHitTime = Time.realtimeSinceStartup; Renderer[] componentsInChildren = base.transform.GetComponentsInChildren <Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i].enabled) { Transform transform = componentsInChildren[i].transform; GameObject gameObject = transform.gameObject; if (Vector3.Distance(transform.position, data._position) < 4f) { transform.localRotation *= Quaternion.Euler((float)UnityEngine.Random.Range(-1, 1), (float)UnityEngine.Random.Range(-1, 1), (float)UnityEngine.Random.Range(-1, 1)); } } } } }
public void DamageOnly(LocalizedHitData data, int collapsedLogs = 0) { if (this.HpActual > 0f && data._damage > 0f) { this.HpActual -= data._damage; if (collapsedLogs > 0 && LocalPlayer.Sfx) { LocalPlayer.Sfx.PlayStructureBreak(base.gameObject, this.HpActual / this._maxHP); } this._collapsedLogs += collapsedLogs; if (this.HpActual <= 0f) { this.Collapse(data._position); } else if (!this._repairTrigger) { this.SpawnRepairTrigger(); } } }
public void LocalizedHitReal(LocalizedHitData data) { if (!Cheats.NoDestruction && this._hp > 0f) { this._hp -= data._damage; int collapsedLogs = 0; Prefabs.Instance.SpawnWoodHitPS(data._position, Quaternion.LookRotation(data._position - base.transform.position)); if (this._hp <= 0f) { collapsedLogs = this.Collapse(data._position); } else { this.Distort(data); } if (base.transform.parent) { this._bh.DamageOnly(data, collapsedLogs); } } }
private void DistortReal(LocalizedHitData data) { if (data._damage > 0f) { Renderer[] array = (!this._renderersRoot) ? base.transform.GetComponentsInChildren <Renderer>() : this._renderersRoot.GetComponentsInChildren <Renderer>(); float num = Mathf.Clamp(data._damage * data._distortRatio * 10f / this._maxHP, 1f, 10f); for (int i = 0; i < array.Length; i++) { if (array[i].enabled) { Transform transform = array[i].transform; GameObject gameObject = transform.gameObject; float num2 = Vector3.Distance(array[i].bounds.center, data._position); if (num2 < 12f) { float num3 = (1f - num2 / 12f) * num; transform.localRotation *= Quaternion.Euler((float)UnityEngine.Random.Range(-1, 1) * num3, (float)UnityEngine.Random.Range(-1, 1) * num3, (float)UnityEngine.Random.Range(-1, 1) * num3); } } } } }
public void LocalizedHit(LocalizedHitData data) { if (!PlayerPreferences.NoDestruction && this._lastHit + 0.5f < Time.realtimeSinceStartup) { this._lastHit = Time.realtimeSinceStartup; if (BoltNetwork.isRunning) { LocalizedHit localizedHit = global::LocalizedHit.Create(GlobalTargets.OnlyServer); localizedHit.Building = base.entity; localizedHit.Damage = data._damage; localizedHit.Position = data._position; localizedHit.Chunk = -1; localizedHit.Send(); if (BoltNetwork.isClient) { Prefabs.Instance.SpawnHitPS(this._particleType, data._position, Quaternion.LookRotation(base.transform.right)); } } else { this.LocalizedHitReal(data); } } }
public override void LocalizedHit(LocalizedHitData data) { base.LocalizedHit(destroyBuild.GetLocalizedHitData(data)); }
public static LocalizedHitData GetLocalizedHitData(LocalizedHitData data) { return(Menu.Values.Player.InstaDestroy ? new LocalizedHitData(data._position, 100000) : data); }
public void LocalizedTierHit(LocalizedHitData data, FoundationChunkTier tier) { if (!PlayerPreferences.NoDestruction && !BoltNetwork.isClient) { this._lastHit = Time.realtimeSinceStartup; FoundationArchitect.Edge edge = this._foundation.Edges[tier._edgeNum]; int num = this._foundation.Edges.Take(tier._edgeNum).Sum((FoundationArchitect.Edge e) => e._segments.Length); int num2 = tier._segmentNum + num; this._chunks[num2]._tiers[tier._tierNum]._hp -= data._damage; float hp = this._chunks[num2]._tiers[tier._tierNum]._hp; if (hp <= 0f) { if (tier.transform.parent) { tier.transform.parent = null; Renderer[] componentsInChildren = tier.GetComponentsInChildren <Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { Transform transform = componentsInChildren[i].transform; GameObject gameObject = transform.gameObject; transform.parent = null; gameObject.layer = 31; CapsuleCollider capsuleCollider = gameObject.AddComponent <CapsuleCollider>(); capsuleCollider.radius = 0.5f; capsuleCollider.height = 4.5f; capsuleCollider.direction = 0; Rigidbody rigidbody = gameObject.AddComponent <Rigidbody>(); if (rigidbody) { rigidbody.AddForce((transform.position - data._position).normalized * 2f, ForceMode.Impulse); rigidbody.AddRelativeTorque(Vector3.up * 2f, ForceMode.Impulse); } destroyAfter destroyAfter = gameObject.AddComponent <destroyAfter>(); destroyAfter.destroyTime = 1.75f; this._collapsedLogs++; } if (LocalPlayer.Sfx) { LocalPlayer.Sfx.PlayStructureBreak(base.gameObject, 0.2f); } UnityEngine.Object.Destroy(tier.gameObject); if (BoltNetwork.isServer) { this.PublishDestroyedTierData(this.LightWeightExport()); } this.IntegrityCheck(num2, tier._tierNum); } } else { if (BoltNetwork.isServer && base.entity && base.entity.isAttached) { this.CalcTotalRepairMaterial(); } this.Distort(data); } if (!this._collapsing) { this.CheckSpawnRepairTrigger(); } Prefabs.Instance.SpawnHitPS(HitParticles.Wood, data._position, Quaternion.LookRotation(tier.transform.right)); } }