public void AnchorDestroyed(StructureAnchor anchor) { if (base.gameObject) { UnityEngine.Object.Destroy(base.gameObject); } }
public int GetAnchorIndex(StructureAnchor anchor) { if (this._mode == FoundationArchitect.Modes.Auto) { StructureAnchor[] componentsInChildren = base.gameObject.GetComponentsInChildren <StructureAnchor>(); for (int i = 0; i < componentsInChildren.Length; i++) { if (object.ReferenceEquals(anchor, componentsInChildren[i])) { return(i); } } } else { for (int j = 0; j < this._anchors.Count; j++) { if (object.ReferenceEquals(anchor, this._anchors[j])) { return(j); } } } throw new Exception("Unknown anchor: " + anchor); }
private void CheckLockAnchor(StructureAnchor anchor) { if (anchor && anchor._hookedInStructure == null && anchor != this._anchor1 && this.ValidateAnchor(anchor.transform)) { base.transform.parent = null; base.transform.position = anchor.transform.TransformPoint(anchor._upperPositionOffset); base.transform.rotation = anchor.transform.rotation; this._anchor1 = anchor; } }
void IAnchorableStructure.AnchorDestroyed(StructureAnchor anchor) { BuildingHealth component = base.GetComponent <BuildingHealth>(); if (component) { component.Collapse(anchor.transform.position); } else if (base.gameObject) { UnityEngine.Object.Destroy(base.gameObject); } }
private void CheckLockTempAnchor(StructureAnchor anchor) { if (LocalPlayer.Create.BuildingPlacer.OnDynamicClear && anchor && anchor._hookedInStructure == null && anchor != this._anchor1 && anchor != this._anchor2 && anchor != this._tmpAnchor && (!this._anchor1 || !this._anchor1.GetComponentInParent <PrefabIdentifier>().Equals(anchor.GetComponentInParent <PrefabIdentifier>()))) { if (base.transform.parent == null) { this.RevertFirstAnchorSnapping(); } this._placerOffset = base.transform.localPosition; base.transform.parent = null; base.transform.position = anchor.transform.position; base.transform.rotation = anchor.transform.rotation; this._tmpAnchor = anchor; this._tmpAnchor._hookedInStructure = this; } }