Beispiel #1
0
        public void UpdateAllCharacters()
        {
            var debugController = ApplicationController.Instance.DebugController;

            Characters.ForEach(c =>
            {
                c.UpdateCells();

                var gridCell         = _grid.GetGridCell((int)c.PositionOnGrid.x, (int)c.PositionOnGrid.y);
                c.transform.position = gridCell.CenterInScreenCoord;
                c.InitializeConnectionPoints();
                c.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(c.GridSize.x * _grid.CellSize, c.GridSize.y * _grid.CellSize);

                c.UpdateConnectionPoints();

                _grid.SetGridCells(gridCell.CenterInScreenCoord, c);
            });
        }
Beispiel #2
0
        private void UpdateVisuals()
        {
            foreach (var wirePiece in _wirePieces)
            {
                var gridCell = _grid.GetGridCell((int)wirePiece.PositionOnGrid.x, (int)wirePiece.PositionOnGrid.y);
                wirePiece.transform.position = gridCell.CenterInScreenCoord;
                wirePiece.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(wirePiece.GridSize.x * _grid.CellSize, wirePiece.GridSize.y * _grid.CellSize);

                wirePiece.UpdateCells();
            }
        }
Beispiel #3
0
        public static void StartMove(DrawableBase moveHandle, Vector2 startDragPos, List <DrawableBase> drawables)
        {
            _selection     = drawables;
            _startDragCell = _grid.GetGridCell(moveHandle.transform.position);
            _moveHandle    = moveHandle;
            _snapDiff      = Vector2.zero;

            drawables.ForEach(d =>
            {
                d.transform.SetAsLastSibling();
                d.ClearCells();
                _oldPositions.Add(d, d.ScreenPivot);

                if (d.Type != DrawableBase.DrawableType.Wire)
                {
                    var character = d as CharacterBase;
                    character.PowerOn(0);
                }
            });

            _selectionController.ClearSelection();
            _isMoving = true;
        }