示例#1
0
        public bool MoveShip(Spaceship ship, ArbiterTreeNode transferNode)
        {
            string          token = ship.Token;
            ArbiterTreeNode sourceNode;

            if (!_nodeByShipToken.Remove(token, out sourceNode))
            {
                return(false);
            }

            _nodeByShipToken[token] = transferNode;
            sourceNode.ShipCount--;
            transferNode.ShipCount++;

            Messages.ShipTransferred msg = new Messages.ShipTransferred()
            {
                Ship = ship
            };
            BusMaster.SendMessage(msg, transferNode.Peer);
            return(true);
        }
示例#2
0
文件: Api.cs 项目: UofG-CS21/SGame
        private void OnShipTransferred(NetPeer peer, Messages.ShipTransferred msg)
        {
            LocalSpaceship localShip = new LocalSpaceship(msg.Ship, _gameTime);

            QuadTreeNode.ShipsByToken.Add(msg.Ship.Token, localShip);
        }