예제 #1
0
        public object Clone()
        {
            var shipConfig = new ShipConfig();

            shipConfig.ID     = this.ID;
            shipConfig.Length = this.Length;
            shipConfig.Count  = this.Count;
            return(shipConfig);
        }
예제 #2
0
        public bool ForceKillShip(Point point)
        {
            var ship = GetShipAtPoint(point);

            if (ship == null)
            {
                return(false);
            }

            ShipConfig currentConf = null;

            foreach (var conf in GameConfig.shipConfigs)
            {
                if (conf.Length == ship.Length)
                {
                    currentConf = conf;
                    break;
                }
            }

            if (currentConf == null)
            {
                return(false);
            }

            Ship nShip = new Ship(currentConf);

            nShip.Orientation = ship.Orientation;
            nShip.Position    = ship.Position;
            nShip.Status      = ShipStatus.Dead;

            foreach (var pp in nShip.GetOwnNeededSpace().AllPoints())
            {
                nShip.DamagePoint(pp);
            }

            ForceDeleteShip(ship);
            ForceAddShip(nShip);

            return(true);
        }
예제 #3
0
 public Ship(ShipConfig config)
 {
     this.ConfigID = config.ID;
     this.Length   = config.Length;
 }