Ejemplo n.º 1
0
    private static void DeleteContentFromCell(ZelleComponent zelle)
    {
        var content = zelle.GetComponentInChildren <ZellInhaltComponent>();

        if (content)
        {
            Object.Destroy(content.gameObject);
        }
    }
Ejemplo n.º 2
0
 private void CreateContentInCell(ZelleComponent newCell)
 {
     StartCoroutine(CreateContentInCell(new CellInitParameters
     {
         PoolData  = poolData,
         ZelleCopy = newCell,
         FindCellWithContentTypeHandler = FindCellsWithContentType,
         OnCellContentCreatedHandler    = OnCellContentCreated
     }));
 }
Ejemplo n.º 3
0
    private void OnCellCreated(ZelleComponent newCell)
    {
        Debug.Log($"Zelle erstellt in Coordinate {newCell.Index}");

        newCell.ContentReachedCellEvent += EvaluateMatchOfCellContentInCell;

        if (contentErstBeiStart)
        {
            return;
        }

        CreateContentInCell(newCell);
    }
Ejemplo n.º 4
0
    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);
            }
        }
    }
Ejemplo n.º 5
0
 protected static void Delete(ZelleComponent zelle)
 {
     UnityEngine.Object.Destroy(zelle.gameObject);
 }
Ejemplo n.º 6
0
 public void TriggerCellCreated(ZelleComponent copyCell)
 {
     OnCellCreatedHandler?.Invoke(copyCell);
 }