Example #1
0
        protected override bool Create()
        {
            if (!base.Create())
            {
                return(false);
            }

            _squareBitMask = LayerMask.GetMask("BoardSquare");
            _hoveredSquare.DistinctUntilChanged().Subscribe(sq => _hoverSquare.Value = sq);
            HoverSquare.Subscribe(sq =>
            {
                OverlayView.Clear();
                if (sq == null)
                {
                    return;
                }
                var p = Agent.At(sq.Coord);
                if (p == null)
                {
                    return;
                }
                ShowSquares(sq.Coord);
            });

            HoverPiece.Subscribe(p => { if (p != null)
                                        {
                                            Info($"Dragging {p} @{HoverSquare.Value}");
                                        }
                                 });

            return(true);
        }
Example #2
0
        public override void Create()
        {
            _squareBitMask = LayerMask.GetMask("BoardSquare");
            _hoveredSquare.DistinctUntilChanged().Subscribe(sq => _hoverSquare.Value = sq);
            HoverSquare.Subscribe(sq =>
            {
                OverlayView.Clear();
                if (sq == null)
                {
                    return;
                }
                var p = Agent.At(sq.Coord);
                if (p == null)
                {
                    return;
                }
                ShowSquares(sq.Coord);
            });

            HoverPiece.Subscribe(p => Info($"Dragging {p} @{HoverSquare.Value}"));
        }