public virtual void TakeDamage(DamageInfo damage_info) { if (this.m_CutData != null && this.m_CutData.Count > 0) { Transform transform = this.FindClosestCutDummy(damage_info.m_Position); if (transform != null) { for (int i = 0; i < this.m_CutData.Count; i++) { CutData cutData = this.m_CutData[i]; if (cutData.m_DummyName == transform.name) { cutData.m_Health -= damage_info.m_Damage; if (cutData.m_Health < 0f) { cutData.m_Health = 0f; } if (cutData.m_Health == 0f) { this.DestroyMe(damage_info, cutData.m_DestroyedPrefabName); } SkinnedMeshRenderer component = base.GetComponent <SkinnedMeshRenderer>(); Mesh mesh = new Mesh(); component.BakeMesh(mesh); if (component) { Vector3[] vertices = mesh.vertices; for (int j = 0; j < cutData.m_VerticesToMorph.Count; j++) { int num = cutData.m_VerticesToMorphIndex[j]; if (Vector3.Dot(damage_info.m_HitDir, component.transform.TransformVector(mesh.normals[num])) < -0.3f) { vertices[num] = cutData.m_VerticesToMorph[j] + cutData.m_VerticesMorphTarget[j] * (1f - cutData.m_Health / cutData.m_MaxHealth); } } mesh.vertices = vertices; component.sharedMesh = mesh; component.sharedMesh.RecalculateNormals(); } } } } return; } this.m_Item.m_Info.m_Health -= damage_info.m_Damage; if (this.m_Item.m_Info.m_Health < 0f) { this.m_Item.m_Info.m_Health = 0f; } if (this.m_Item.m_Info.m_Health == 0f) { this.DestroyMe(damage_info, ""); return; } if (base.GetComponent <PushLeaves>()) { LeavesPusher.Get().PushHit(base.gameObject, damage_info.m_HitDir); } }
private void Update() { if (this.m_LastUpdateTime > Time.time - 0.5f) { return; } if (!this.ReplIsOwner() && Player.Get().transform.position.Distance(base.transform.position) < 30f) { LeavesPusher.Get().Push(base.gameObject, 0.5f, new Vector3?(Vector3.up * 0.5f)); } }
private void UpdateLeavesPusher() { LeavesPusher.Get().Push(this.m_BoxCollider.bounds.center, this.m_Radius); }
private void UpdateLeavesPusher() { LeavesPusher.Get().Push(base.gameObject, this.m_Radius, new Vector3?(this.m_BoxCollider.bounds.center - base.transform.position)); }