Beispiel #1
0
        public void ReplaceElements(Vector2Int coordinatesA, Vector2Int coordinatesB)
        {
            var elementA = _field[coordinatesA.x, coordinatesA.y];
            var elementB = _field[coordinatesB.x, coordinatesB.y];

            _field[coordinatesA.x, coordinatesA.y] = elementB;
            _field[coordinatesB.x, coordinatesB.y] = elementA;
            var args = new ElementsReplacedArgs();

            args.elementA = coordinatesA;
            args.elementB = coordinatesB;
            ElementsReplaced?.Invoke(args);
        }
 private void OnElementsReplaced(ElementsReplacedArgs args)
 {
     _fieldView.ReplaceVisualElements(args.elementA.x, args.elementA.y, args.elementB.x, args.elementB.y);
 }