private static void DeleteContentFromCell(ZelleComponent zelle) { var content = zelle.GetComponentInChildren <ZellInhaltComponent>(); if (content) { Object.Destroy(content.gameObject); } }
private void CreateContentInCell(ZelleComponent newCell) { StartCoroutine(CreateContentInCell(new CellInitParameters { PoolData = poolData, ZelleCopy = newCell, FindCellWithContentTypeHandler = FindCellsWithContentType, OnCellContentCreatedHandler = OnCellContentCreated })); }
private void OnCellCreated(ZelleComponent newCell) { Debug.Log($"Zelle erstellt in Coordinate {newCell.Index}"); newCell.ContentReachedCellEvent += EvaluateMatchOfCellContentInCell; if (contentErstBeiStart) { return; } CreateContentInCell(newCell); }
private void CreateCells(BoardParameters parameter) { var prefab = parameter.ZelleVorlage; var width = prefab.transform.localScale.x; var height = prefab.transform.localScale.y; var totalWidth = width * parameter.Spalten + parameter.Abstand * (parameter.Spalten - 1); var totalHeight = height * parameter.Zeilen + parameter.Abstand * (parameter.Zeilen - 1); for (int row = parameter.Zeilen - 1; row >= 0; row--) { for (int column = 0; column < parameter.Spalten; column++) { (int column, int row)index = (column, row); float x = column * (width + parameter.Abstand) - totalWidth / 2; float y = row * (height + parameter.Abstand) - totalHeight / 2; var position = new Vector3(x, y); ZelleComponent copyCell = UnityEngine.Object.Instantiate(prefab, position, Quaternion.identity, parameter.TransformParent).GetComponent <ZelleComponent>(); copyCell.Index = index; parameter.TriggerCellCreated(copyCell); } } }
protected static void Delete(ZelleComponent zelle) { UnityEngine.Object.Destroy(zelle.gameObject); }
public void TriggerCellCreated(ZelleComponent copyCell) { OnCellCreatedHandler?.Invoke(copyCell); }