Пример #1
0
 public void Init()
 {
     for (int column = 0; column < _configuration.LevelWidth; column++)
     {
         for (int row = 0; row < _configuration.LevelHeight; row++)
         {
             Vector2Int position = new Vector2Int(column, row);
             EcsEntity  entity   = _gameField.Cells[position];
             ref Cell   cell     = ref entity.Ref <Cell>().Unref();
             cell.View = _objectPool.Get(cell.Configuration.ViewExample);
             cell.View.transform.position = new Vector3(position.x, _configuration.LevelHeight + 1);
             cell.View.Entity             = entity;
         }
     }
Пример #2
0
        public void Init()
        {
            for (int column = 0; column < _configuration.LevelWidth; column++)
            {
                for (int row = 0; row < _configuration.LevelHeight; row++)
                {
                    EcsEntity entity = _gameField.Cells[new Vector2Int(column, row)];
                    ref Cell  cell   = ref entity.Ref <Cell>().Unref();
                    _gameField.Cells[new Vector2Int(column, row)].Set <ChangeFieldAnimating>();

                    Vector3 targetPosition = new Vector3(column, row);
                    cell.View.transform
                    .DOMove(targetPosition, _configuration.Animation.CellMovingSeconds)
                    .OnComplete(() => RemoveFieldChangingState(entity));
                }
            }