private void SetConnectedTo() { ConnectedTo.Clear(); ConnectedTo = SurroundingElementInfo.GetConnectedElements( transform.position.ToVector3Int(), SurroundingElementInfo.ResolveDirectionsValidForBuildBasePosition(BuildBaseOn)).ToList(); ConnectedTo.ForEach(RegisterToNeighbourElement); }
/// <summary> /// Run from BuildPositionProvider OnReplacePreviewPositionChanged /// </summary> /// <param name="previewPosition"></param> public void ShowPreviewElement(Vector3Int previewPosition) { if (replacedElement != null) { replacedElement.gameObject.SetActive(true); } replacedElement = BuiltElementsStoreController.GetElementAtPosition(previewPosition); if (previewItem.CanBeBuilt == BuildPosition.Top && !SurroundingElementInfo.IsGroundOrBuiltElementBellow(previewPosition)) { return; } replacedElement.gameObject.SetActive(false); DisplayPreviewElement(previewPosition); }
private void UpdateSurroundingElementsConnections(BuildElement element) { SurroundingElementInfo.GetSurroundingElements(element) .ForEach(item => item.SetConnections()); }
private void SetIsGrounded() { IsGrounded = SurroundingElementInfo.IsAnyPositionAroundGround(transform.position.ToVector3Int()); }