Пример #1
0
        public static ShipBuilder getInstance()
        {
            if (_instance == null)
            {
                _instance = new ShipBuilder();
            }

            return(_instance);
        }
Пример #2
0
        public void setInitStatus()
        {
            ShipBuilder builder = ShipBuilder.getInstance();
            ShipFactory factory = new HCShipFactory();

            ship1         = builder.buildShip(factory);
            ship2         = builder.buildShip(factory);
            ship3         = builder.buildShip(factory);
            player        = Player.getInstance();
            player.health = 100;
            damageRange   = player.getWeapon().getRange() * 10 + 30;

            player.setLocation(10, 10);
            ship1.setLocation(1, 4);
            ship2.setLocation(0, 2);
            ship3.setLocation(2, 1);
            onPropertyChanged(string.Empty);
        }