public virtual bool canSnap(Collider other) { BuildSnapping snapping = other.gameObject.GetComponent <BuildSnapping>(); if (!snapping || isOccupied() || snapping.isSnapping()) { return(false); } return(true); }
private void OnTriggerEnter(Collider other) { if (!canSnap(other) || !isCorrectType(other)) { return; } BuildSnapping snapping = other.gameObject.GetComponent <BuildSnapping>(); snappedObject = other.gameObject; snapping.activePoint = this; }
public override GameObject prepare() { base.prepare(); Renderer renderer = spawnedObj.GetComponent <Renderer>();; if (renderer) { renderer.material = activeInvalidMaterial; } buildSnapping = spawnedObj.AddComponent <BuildSnapping>(); return(spawnedObj); }