private void lookAtExplosion(Vector3 position) { Vector3 b = new Vector3(1f, 0f, 1f); if (!this._idleIfPresent && Vector3.Distance(Vector3.Scale(position, b), Vector3.Scale(base.transform.position, b)) < 3.5f) { if (LocalPlayer.Sfx) { LocalPlayer.Sfx.PlayBreakWood(base.gameObject); } LOD_Stump componentInParent = base.GetComponentInParent <LOD_Stump>(); LOD_Trees lod_Trees = (!componentInParent) ? base.GetComponentInParent <LOD_Trees>() : componentInParent.transform.parent.GetComponent <LOD_Trees>(); if (lod_Trees) { if (componentInParent && componentInParent.Pool.IsSpawned(base.transform)) { base.transform.parent = componentInParent.Pool.transform; componentInParent.Pool.Despawn(base.transform); } if (!BoltNetwork.isRunning) { this.Finalize(lod_Trees, (!componentInParent) ? base.gameObject : componentInParent.gameObject); } else { RemoveStump removeStump = RemoveStump.Create(GlobalTargets.OnlyServer); removeStump.TargetTree = lod_Trees.GetComponent <BoltEntity>(); if (this._blownUpStump) { removeStump.Position = base.transform.position; removeStump.Rotation = base.transform.rotation; removeStump.CutUpStumpPrefabId = this._blownUpStump.GetComponent <BoltEntity>().prefabId; } removeStump.Send(); this.Finalize((!BoltNetwork.isServer) ? null : lod_Trees, (!componentInParent) ? base.gameObject : componentInParent.gameObject); } } else { TreeHealth componentInParent2 = base.GetComponentInParent <TreeHealth>(); if (componentInParent2 && componentInParent2.LodTree) { if (BoltNetwork.isRunning) { CoopTreeId component = componentInParent2.LodTree.GetComponent <CoopTreeId>(); if (component) { component.Goto_Removed(); } } this.Finalize(componentInParent2.LodTree, componentInParent2.gameObject); } } } }
public void Start() { int stepCount = this.GetStepCount(); LOD_Base[] array = UnityEngine.Object.FindObjectsOfType <LOD_Base>(); List <LOD_Base> list = new List <LOD_Base>(); Vector3 position = base.transform.position; float num = this.Radius + this.Length; num *= num; float num2 = this.Radius * this.Radius; LOD_Base[] array2 = array; for (int i = 0; i < array2.Length; i++) { LOD_Base lOD_Base = array2[i]; if ((lOD_Base.transform.position - position).sqrMagnitude < num) { list.Add(lOD_Base); } } for (int j = 0; j < stepCount; j++) { float progress = (float)j / (float)stepCount; Vector3 position2 = this.GetPosition(progress); foreach (LOD_Base current in list) { if ((current.transform.position - position2).sqrMagnitude < num2) { CoopTreeId coopTreeId = null; if (BoltNetwork.isServer) { coopTreeId = current.GetComponent <CoopTreeId>(); } UnityEngine.Object.Destroy(current); if (coopTreeId) { coopTreeId.Goto_Removed(); } } } if (this.ShouldCutGrass) { NeoGrassCutter.Cut(position2, this.Radius, false); } } }
public void startClearing() { int stepCount = this.GetStepCount(); LOD_Base[] array = UnityEngine.Object.FindObjectsOfType <LOD_Base>(); List <LOD_Base> list = new List <LOD_Base>(); Vector3 position = base.transform.position; float num = this.Radius + this.Length; num *= num; float num2 = this.Radius * this.Radius; foreach (LOD_Base lod_Base in array) { if (!(lod_Base is LOD_Rocks) && (lod_Base.transform.position - position).sqrMagnitude < num) { list.Add(lod_Base); } } for (int j = 0; j < stepCount; j++) { float progress = (float)j / (float)stepCount; Vector3 position2 = this.GetPosition(progress); foreach (LOD_Base lod_Base2 in list) { if ((lod_Base2.transform.position - position2).sqrMagnitude < num2) { CoopTreeId coopTreeId = null; if (BoltNetwork.isServer) { coopTreeId = lod_Base2.GetComponent <CoopTreeId>(); } Debug.Log(lod_Base2 + " CLEARED"); UnityEngine.Object.DestroyImmediate(lod_Base2); if (coopTreeId) { coopTreeId.Goto_Removed(); } } } if (this.ShouldCutGrass) { NeoGrassCutter.Cut(position2, this.Radius, false); } } }
private void lookAtExplosion(Vector3 position) { Vector3 b = new Vector3(1f, 0f, 1f); if (!this._idleIfPresent && !BoltNetwork.isClient && Vector3.Distance(Vector3.Scale(position, b), Vector3.Scale(base.transform.position, b)) < 3.5f) { LocalPlayer.Sfx.PlayBreakWood(base.gameObject); LOD_Stump componentInParent = base.GetComponentInParent <LOD_Stump>(); if (componentInParent) { LOD_Trees component = componentInParent.transform.parent.GetComponent <LOD_Trees>(); if (component.Pool.IsSpawned(base.transform)) { base.transform.parent = component.Pool.transform; component.Pool.Despawn(base.transform); } if (BoltNetwork.isRunning) { CoopTreeId component2 = component.GetComponent <CoopTreeId>(); if (component2) { component2.Goto_Removed(); } } this.Finalize(component, componentInParent.gameObject); } else { TreeHealth componentInParent2 = base.GetComponentInParent <TreeHealth>(); if (componentInParent2 && componentInParent2.LodTree) { if (BoltNetwork.isRunning) { CoopTreeId component3 = componentInParent2.LodTree.GetComponent <CoopTreeId>(); if (component3) { component3.Goto_Removed(); } } this.Finalize(componentInParent2.LodTree, componentInParent2.gameObject); } } } }
private void Burnt(GameObject trunk) { if (!BoltNetwork.isClient) { TreeHealth.OnTreeCutDown.Invoke(base.transform.position); EventRegistry.Player.Publish(TfEvent.CutTree, this); if (this.LodTree != null) { this.LodTree.SendMessageToTargets("OnTreeCutDown", trunk); if (BoltNetwork.isRunning) { CoopTreeId component = this.LodTree.GetComponent <CoopTreeId>(); if (component) { component.Goto_Removed(); } } UnityEngine.Object.Destroy(this.LodTree); } } }
private void Burnt(GameObject trunk) { if (!BoltNetwork.isClient) { TreeHealth.OnTreeCutDown.Invoke(base.transform.position); GameStats.TreeCutDown.Invoke(); if (this.LodTree != null) { if (this.LodTree.OnTreeCutDownTarget != null) { this.LodTree.OnTreeCutDownTarget.SendMessage("OnTreeCutDown", trunk); } if (BoltNetwork.isRunning) { CoopTreeId component = this.LodTree.GetComponent <CoopTreeId>(); if (component) { component.Goto_Removed(); } } UnityEngine.Object.Destroy(this.LodTree); } } }