public Ship(ShipType type, GridPosition front, GridPosition rear, int length, bool isHorizontal)
 {
     this.type = type;
     occupiedSquares = new GridPosition[length];
     this.length = length;
     occupiedSquares[0] = front;
     if (isHorizontal)
     {
         int difference = rear.x - front.x;
         for (int x = 1; x < length; x++)
         {
             occupiedSquares[x] = new GridPosition(0, 0);
             if (difference > 0)
                 occupiedSquares[x].x = front.x + x;
             else if (difference < 0)
                 occupiedSquares[x].x = front.x - x;
             occupiedSquares[x].y = front.y;
         }
     }
     else if (isHorizontal == false)
     {
         int difference = front.y - rear.y;
         for (int y = 1; y < length; y++)
         {
             occupiedSquares[y] = new GridPosition(0, 0);
             if (difference > 0)
                 occupiedSquares[y].y = front.y - y;
             else if (difference < 0)
                 occupiedSquares[y].y = front.y + y;
             occupiedSquares[y].x = front.x;
         }
     }
 }
Exemple #2
0
 public Invader(ShipType invaderType, Point location, int score)
 {
     this.InvaderType = invaderType;
     this.Location = location;
     this.Score = score;
     image = InvaderImage(0);
 }
 public Invader(ShipType invaderType, Point location, int score)
 {
     m_InvaderType = invaderType;
     m_Location = location;
     m_Score = score;
     m_image = InvaderImage(0);
 }
Exemple #4
0
 public Ship(ShipType type)
 {
     this.Position = new List<Point>();
     this.Type = type;
     switch (this.Type)
     {
         case ShipType.Battleship:
             this.Length = 5;
             break;
         case ShipType.Cruiser:
             this.Length = 4;
             break;
         case ShipType.Submarine:
             this.Length = 3;
             break;
         case ShipType.Frigate:
             this.Length = 3;
             break;
         case ShipType.Minesweeper:
             this.Length = 2;
             break;
         default:
             break;
     }
 }
 public Invader(ShipType invaderType, Point location, int score)
 {
     InvaderType = invaderType;
     Location = location;
     Score = score;
     image = InvaderImage((int)invaderType);
 }
 private FirstPlayer(ShipType type)
     : base(type)
 {
     this.Ship.Position = this.SpawnFirst;
     this.ShipType = type;
     this.PlayerType = PlayerTypes.FirstPlayer;
 }
Exemple #7
0
        public ShipType shipType; // Тип корабля

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Создание нового корабля
        /// </summary>
        /// <param name="owner">Игрок-владелец корабля</param>
        /// <param name="shipType">Тип корабля</param>
        /// <param name="shipPosition">Позиция корабля</param>
        /// <param name="shipCells">Список ячеек, которые занимает корабль</param>
        public Ship(Player owner, ShipType shipType, ShipPosition shipPosition, List<Cell> shipCells)
        {
            this.owner = owner;
            this.shipType = shipType;
            this.shipPosition = shipPosition;
            this.shipCells = shipCells;
        }
Exemple #8
0
 public Ship(ShipType type)
 {
     mType = type;
     /*if (length <= 1)
     {
         throw new ArgumentOutOfRangeException("length");
     }*/
     switch(mType) {
     case ShipType.AIRCRAFT_CARRIER:
         mLength = 5;
         break;
     case ShipType.BATTLESHIP:
         mLength = 4;
         break;
     case ShipType.DESTROYER:
         mLength = 3;
         break;
     case ShipType.SUBMARINE:
         mLength = 3;
         break;
     case ShipType.PATROL_BOAT:
         mLength = 2;
         break;
     }
     hitMarkers = new bool[mLength];
     for(int i = 0;i < mLength;i++) hitMarkers[i] = false;
 }
    /// <summary>
    /// Temp method for AI building
    /// </summary>
    /// <param name="shipType"></param>
    /// <param name="blueprint"></param>
    /// <param name="position"></param>
    /// <param name="rotation"></param>
    /// <returns></returns>
    public TurnBasedUnit BuildShip(ShipType shipType, ShipBlueprint blueprint, Vector3 position, Quaternion rotation)
    {
        blueprintBeingBuilt = blueprint;
        #if FULL_DEBUG
        //if (shipType == ShipType.AI_Ship)
        //if(false)
        //{
        //    Debug.LogError("BEFORE ... blueprint " + blueprintBeingBuilt);
        //    Debug.LogError("hull.emptyCompGrid: ");
        //    foreach (ComponentSlot slot in blueprintBeingBuilt.hull.EmptyComponentGrid)
        //    {
        //        Debug.LogError("ComponentSlot: " + slot.index + ": " + slot.InstalledComponent);

        //    }
        //    Debug.LogError("hull.index_slot_table: ");
        //    foreach (var item in blueprintBeingBuilt.slot_component_table)
        //    {
        //        Debug.LogError("slot: " + item.Key + " comp: " + item.Value);
        //    }
        //}

        #endif

        return InstantiateShip(false, shipType, position, rotation);
    }
        public ShipTypeViewModel(ShipType stype)
        {
            this.Id = stype.Id;

            // [ID = 8 (金剛型戦艦)] と [ID = 9 (金剛型以外の戦艦)] がどちらも "戦艦" 表記で区別がつかないため、
            // ID = 8 の方を "巡洋戦艦" に変更
            this.DisplayName = (stype.Id == 8 && stype.Name == "戦艦") ? "巡洋戦艦" : stype.Name;
        }
Exemple #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Ship"/> class.
 /// </summary>
 /// <param name="bow">The ship's bow.</param>
 /// <param name="type">The ship type.</param>
 /// <param name="direction">The ship direction.</param>
 public Ship(Bow bow, ShipType type, ShipDirection direction)
 {
     this.Bow = bow;
     this.Type = type;
     this.IsSunk = false;
     this.Direction = direction;
     this.Size = this.GetSize(type);
 }
Exemple #12
0
        public static Ship CreateShip(ShipType shipType, Vector2 position, Vector2 velocity)
        {
            Ship ship = null;

            switch (shipType)
            {
                case ShipType.Fighter1:
                case ShipType.Fighter2:
                    return new Ship(shipType) { Position = position, Velocity = velocity };

                case ShipType.OrbitalCommand1:
                case ShipType.OrbitalCommand2:
                    ship = new Ship(shipType);
                    ship.Position = position;
                    ship.Velocity = velocity;
                    ship.WeaponReloadTime = 0.3f;
                    ship.NumberShots = 5;
                    ship.MaxSpeed = 1.0f;
                    ship.MaxForce = 0.01f;
                    ship.WeaponRange = 2000.0f;
                    ship.WeaponAimRange = 500.0f;
                    ship.WeaponVelocity = 5.0f;
                    ship.Hitpoints = 50;
                    ship.Mass = 5.0f;
                    ship.ClickRadius = 100.0f;
                    ship.HitRadius = 50.0f;
                    ship.AvoidRadius = 100.0f;
                    ship.IsPushedByImpacts = false;
                    ship.OnImpactBehaviour = Ship.ImpactBehaviour.SwitchTargetIfCurrentIsOutOfSight;
                    ship.ShotType = ShotTypes.Homing;
                    ship.ResetShots();
                    return ship;
                case ShipType.Dreadnaught:
                    ship = new Ship(shipType);
                    ship.Position = position;
                    ship.Velocity = velocity;
                    ship.WeaponReloadTime = 0.1f;
                    ship.NumberShots = 10;
                    ship.MaxSpeed = 3.0f;
                    ship.MaxForce = 0.05f;
                    ship.WeaponRange = 2000.0f;
                    ship.WeaponAimRange = 500.0f;
                    ship.WeaponVelocity = 5.0f;
                    ship.Hitpoints = 200;
                    ship.Mass = 20.0f;
                    ship.ClickRadius = 200.0f;
                    ship.HitRadius = 100.0f;
                    ship.AvoidRadius = 150.0f;
                    ship.IsPushedByImpacts = false;
                    ship.OnImpactBehaviour = Ship.ImpactBehaviour.SwitchTargetIfCurrentIsOutOfSight;
                    ship.ShotType = ShotTypes.Homing;
                    ship.ResetShots();
                    return ship;

                default:
                    return new Ship(shipType) { Position = position, Velocity = velocity };
            }
        }
        public Invader(ShipType invaderType, Point location, int score)
        {
            this.InvaderType = invaderType;
            this.Location = location;
            this.Score = score;

            createInvaderBitmapArray();
            image = imageArray[0];
        }
		public EnemyShip MakeEnemyShip (ShipType shipType)
		{
			if (shipType == ShipType.UFO)
				return new UFOEnemyShip ();
			else if (shipType == ShipType.Rocket)
				return new RocketEnemyShip ();
			else if (shipType == ShipType.Endboss)
				return new BigEnemyShip ();
			else
				return null;
		}
Exemple #15
0
 public Ship(int length)
 {
     if (length <= 1)
     {
         throw new ArgumentOutOfRangeException("length");
     }
     mType = ShipType.CUSTOM;
     mLength = length;
     hitMarkers = new bool[mLength];
     for(int i = 0;i < mLength;i++) hitMarkers[i] = false;
 }
    private ShipForSale GetShipForSale(ShipType type)
    {
        foreach (var ship in shipPrices)
        {
            if (ship.ShipType == type)
            {
                return ship;
            }
        }

        throw new InvalidOperationException("ship type not in list of buyable types");
    }
Exemple #17
0
 static BaseShip GetShip(ShipType shipType)
 {
     switch(shipType)
     {
         case ShipType.FightShip:
             return new FightShip();
         case ShipType.TransportShip:
             return new TransportShip();
         default:
             throw new Exception("неизвестный тип карабля");
     }
 }
 public void SpawnDestroyer()
 {
     if (Destroyer_totalNumber == 0)
     {
         currentShip = ShipType.None;
         Debug.Log("YOU SHALL NOT SPAWN...ANYMORE DESTROYERS!!");
         return;
     }
     Destroyer_totalNumber--;
     //		SpawnOnlyOnce = 1;
     currentShip = ShipType.Destroyer;
     //		SpawnBoat (1);
     Debug.Log("You may spawn " + Destroyer_totalNumber + " more Destroyers. - Message from SpawnManager (SpawnDestroyer).");
 }
Exemple #19
0
	public IEnumerator WaitBasedOnShipType(ShipType shipType){
		float time2Wait = 0;
		if (shipType == ShipType.Normal){
			time2Wait = 1;
		}
		else if (shipType == ShipType.Alpha){
			time2Wait = 2;
		}
		else if (shipType == ShipType.Bravo){
			time2Wait = 3;
		}

		yield return new WaitForSeconds(time2Wait);
	}
 public static Ship Create(ShipType type)
 {
     switch (type)
     {
         case ShipType.Battleship:
             return new Battleship();
         case ShipType.Cruiser:
             return new Cruiser();
         case ShipType.Destroyer:
             return new Destroyer();
         default:
             throw new InvalidOperationException("invalid ship");
     }
 }
 public void SpawnCrusier()
 {
     if (Crusier_totalNumber == 0)
     {
         currentShip = ShipType.None;
         Debug.Log("YOU SHALL NOT SPAWN...ANYMORE CRUSIERS!!");
         return;
     }
     Crusier_totalNumber--;
     //		SpawnOnlyOnce = 1;
     currentShip = ShipType.Crusier;
     //		SpawnBoat (2);
     Debug.Log("You may spawn " + Crusier_totalNumber + " more Crusiers. - Message from SpawnManager (SpawnCrusier).");
 }
 public bool CanUsedInShip(ShipType type)
 {
     if (this.shipType != null)
     {
         foreach (ShipType type2 in this.shipType)
         {
             if (type2 == type)
             {
                 return true;
             }
         }
     }
     return false;
 }
    public void SpawnBattleship()
    {
        if (Battleship_totalNumber == 0)
        {
            currentShip = ShipType.None;
            Debug.Log("YOU SHALL NOT SPAWN...ANYMORE BATTLESHIPS!!");
            return;
        }

        Battleship_totalNumber--;
        //		SpawnOnlyOnce = 1;
        currentShip = ShipType.Battleship;
        //		SpawnBoat (3);
        Debug.Log("You may spawn " + Battleship_totalNumber + " more Battleships. - Message from SpawnManager (SpawnBattleship).");
    }
Exemple #24
0
 public void SetMaterial(ShipType shipTypeThatFired)
 {
     if (shipTypeThatFired == ShipType.TheUniter){
         bulletRenderer.material = bulletMaterials[0];
     }
     else if (shipTypeThatFired == ShipType.Normal){
         bulletRenderer.material = bulletMaterials[1];
     }
     else if (shipTypeThatFired == ShipType.Alpha){
         bulletRenderer.material = bulletMaterials[2];
     }
     else if (shipTypeThatFired == ShipType.Bravo){
         bulletRenderer.material = bulletMaterials[3];
     }
 }
        public SpawnSelectPlayerState(Player _player)
        {
            index = 0;
            currentShip = ShipType.None;

            modelPosition = new Vector3(0.1f, 0.0f, 1.0f);

            player = _player;

            player.PlayerShip = null;

            if (player.CurrentTeam == Ship.Team.Esxolus)
            {
                assaultFighter = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/esxolus_assault"), Vector2.Zero);
                interceptor = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/esxolus_interceptor"), Vector2.Zero);
                bomber = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/esxolus_bomber"), Vector2.Zero);
                spawnSelectTexture = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/spawn_esx"), new Vector2(142, 418));
                //preparingToLaunch = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/
            }
            else
            {
                assaultFighter = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/halk_assault"), Vector2.Zero);
                interceptor = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/halk_interceptor"), Vector2.Zero);
                bomber = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/halk_bomber"), Vector2.Zero);
                spawnSelectTexture = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/spawn_halk"), new Vector2(142, 418));
            }
            spawnSelectPressA = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/spawn_press_a"), new Vector2(249, 388));
            modelRotation = 0;

            rememberedSpawnShipNumber = getSpawnShips().Count;

            preparedToLaunch = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/spawn_countdown_prep"), new Vector2(278, 113));
            launchIn = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/spawn_countdown_launch"), new Vector2(343, 113));
            one = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/spawn_countdown_1"), new Vector2(361, 167));
            two = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/spawn_countdown_2"), new Vector2(361, 167));
            three = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/spawn_countdown_3"), new Vector2(361, 167));
            four = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/spawn_countdown_4"), new Vector2(361, 167));
            five = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/spawn_countdown_5"), new Vector2(361, 167));
            back = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/Screens/back"), new Vector2(25, 435));

            while (index < getSpawnShips().Count
                && getSpawnShips()[index].ShipTeam != player.CurrentTeam) // They must have a ship, but just in case
            {
                index++;
            }

            LogCat.updateValue("PlayerState", "SpawnSelect");
        }
Exemple #26
0
        public Ship(Vector2 initPos, float initRot, ShipType T, Level L, Player P)
        {
            Position = initPos;

            Type = T;
            myLevel = L;
            myPlayer = P;

            Laser = new Laser(this);

            switch (Type)
            {
                case ShipType.Small:
                    MaxVelocity = 3.00f;
                    AccelerationForce = 0.04f;
                    FiringRate = 1000;
                    AttackPower = 1;
                    HitPoints = 5;
                    Range = 100;
                    shipTex = _smallShipTex;
                    break;

                case ShipType.Medium:
                    MaxVelocity = 1.50f;
                    AccelerationForce = 0.03f;
                    FiringRate = 1500;
                    AttackPower = 3;
                    HitPoints = 20;
                    Range = 150;
                    shipTex = _mediumShipTex;
                    HealthBar = new ProgressBar(new Vector2(Position.X, Position.Y + shipTex.Height / 3), shipTex.Width / 2, 3, 0, HitPoints, myPlayer.Colour);
                    HealthBar.DrawBorder = false;
                    break;

                case ShipType.Large:
                    MaxVelocity = 0.90f;
                    AccelerationForce = 0.02f;
                    FiringRate = 2000;
                    AttackPower = 7;
                    HitPoints = 40;
                    Range = 200;
                    shipTex = _largeShipTex;
                    Laser.Width = 2;
                    HealthBar = new ProgressBar(new Vector2(Position.X, Position.Y + shipTex.Height / 2), shipTex.Width, 3, 0, HitPoints, myPlayer.Colour);
                    HealthBar.DrawBorder = false;
                    break;
            }
        }
Exemple #27
0
 public static Ship CreateShip(ShipType type)
 {
     switch (type)
     {
         case ShipType.Destroyer:
             return new Ship(ShipType.Destroyer, 2);
         case ShipType.Cruiser:
             return new Ship(ShipType.Cruiser, 3);
         case ShipType.Submarine:
             return new Ship(ShipType.Submarine, 3);
         case ShipType.Battleship:
             return new Ship(ShipType.Battleship, 4);
         default:
             return new Ship(ShipType.Carrier, 5);
     }
 }
Exemple #28
0
	public int ShipTypeToGameObjectIndex(ShipType shipType){
		int returnIndex = 0;
		if (shipType == ShipType.TheUniter) {
			returnIndex = 0;
		}
		else if (shipType == ShipType.Normal) {
			returnIndex = 1;
		}
		else if (shipType == ShipType.Alpha) {
			returnIndex = 2;
		}
		else if (shipType == ShipType.Bravo) {
			returnIndex = 3;
		}
		return returnIndex;
	}
Exemple #29
0
        /// <summary>
        /// Creates a new instance of a ship, which is not placed on the playground
        /// </summary>
        /// <param name="owner">The Jabber-ID of the owner</param>
        /// <param name="type">The type</param>                
        public Ship(JID owner, ShipType type, Boolean alternate)
        {
            this.Owner = owner;
            this.IsPlaced = false;
            this.ShipType = type;
            this.HitPoints = new Dictionary<int, bool>();
            this.OverlayColor = Color.White;
            this.IsDestroyed = false;

            switch (type)
            {
                case ShipType.DESTROYER:
                case ShipType.SUBMARINE:
                    this.Orientation = System.Windows.Controls.Orientation.Vertical;
                    break;
                case ShipType.BATTLESHIP:
                case ShipType.AIRCRAFT_CARRIER:
                    this.Orientation = System.Windows.Controls.Orientation.Horizontal;
                    break;
            }
            LoadTexture();

            // Ship is not placed. We place it manually
            switch (type)
            {
                case ShipType.DESTROYER:
                    this.Position = new Vector2(20, DeviceCache.BelowGrid + 20);
                    break;
                case ShipType.SUBMARINE:
                    if (alternate)
                        this.Position = new Vector2(20 + (1 * (this.shipTexture.Width * scaleRate)) + 20, DeviceCache.BelowGrid + 20);
                    else
                        this.Position = new Vector2(20 + (5 * (this.shipTexture.Width * scaleRate)) + 20, DeviceCache.BelowGrid + 20);
                    break;
                case ShipType.BATTLESHIP:
                    this.Position = new Vector2(20 + (2 * (this.shipTexture.Height * scaleRate)) + 20, DeviceCache.BelowGrid + 20);
                    break;
                case ShipType.AIRCRAFT_CARRIER:
                    this.Position = new Vector2(20 + (2 * (this.shipTexture.Height * scaleRate)) + 20, DeviceCache.BelowGrid + (this.shipTexture.Height * scaleRate) + 30);
                    break;
            }

            for (int i = 0; i < this.Size; i++)
            {
                this.HitPoints.Add(i, false);
            }
        }
Exemple #30
0
	/// <summary>
	/// Spawns a ship relative to the Player positoin
	/// </summary>
	public IEnumerator SpawnShip(ShipType shipType){
		Vector3 spawnSpot = Vector3.zero;
		if (shipType == ShipType.Normal){
			spawnSpot = new Vector3(Random.Range(-3f,3f),Constants.ySpawnSpot,Random.Range(15f,20f));
		}
		else if (shipType == ShipType.Alpha){
			spawnSpot = new Vector3(Random.Range(-5f,5f),Constants.ySpawnSpot,Random.Range(15f,20f));
		}
		else if (shipType == ShipType.Bravo){
			float xSpot = (Random.insideUnitCircle.x>0) ? Random.Range(-6f,-3f) : Random.Range(3f,6f);
			spawnSpot = new Vector3(xSpot,Constants.ySpawnSpot,Random.Range(15f,20f));
		}

		spawnSpot += uniterRespawner.TheUniterShip.transform.position;
		Instantiate (shipsToSpawn[ShipTypeToGameObjectIndex (shipType)], spawnSpot, Quaternion.Euler (0f, 180f, 0f));
		yield return null;
	}
 public static int GetShipPrice(ShipType ship)
 {
     return(ship >= 0 ? shipPrices[(int)ship] : 0);
 }
 public AllyShip(Game1 game, Sprite spriteSheet, ShipType type) :
     base(game, spriteSheet)
 {
     this.type = type;
 }
Exemple #33
0
        // constructor:
        public EnemyShip(Texture2D texture, ShipType newShipType, AIType newAIType, Vector2 initialPosition, Game thisGame)
        {
            game = thisGame;

            // set up our initial position:
            xPos = (int)initialPosition.X;
            yPos = (int)initialPosition.Y;

            team = Team.Enemy;

            shipType = newShipType;             // what type of ship?
            aiType   = newAIType;               // what type of behavior?


            gunBarrelOffset = new Vector2(20.0f, 40.0f);

            // set up graphics and stats based on ship type:
            switch (newShipType)
            {
            case ShipType.Grey:
            {
                animFly = new List <Rectangle>
                {
                    new Rectangle(95, 0, 25, 27),
                    new Rectangle(120, 0, 25, 27),
                    new Rectangle(145, 0, 25, 27)
                };

                health    = 5;
                maxHealth = health;
                damage    = 10;
                speed     = 3;
                state     = 0x00;
                break;
            }

            case ShipType.Brown:
            {
                animFly = new List <Rectangle>
                {
                    new Rectangle(96, 28, 25, 27),              // it was showing a dark line on the left with x=95
                    new Rectangle(120, 28, 25, 27),
                    new Rectangle(145, 28, 25, 27)
                };

                health    = 5;
                maxHealth = health;
                damage    = 10;
                speed     = 3;
                state     = 0x00;
                break;
            }

            case ShipType.Green:
            {
                animFly = new List <Rectangle>
                {
                    new Rectangle(168, 0, 25, 27),
                    new Rectangle(168, 28, 25, 27),
                    new Rectangle(168, 55, 25, 27)
                };

                health    = 5;
                maxHealth = health;
                damage    = 10;
                speed     = 4;
                state     = 0x00;

                break;
            }

            case ShipType.Needle:
            {
                animFly = new List <Rectangle>
                {
                    new Rectangle(95, 84, 25, 27),
                    new Rectangle(120, 84, 25, 27),
                    new Rectangle(145, 84, 25, 27)
                };

                health    = 5;
                maxHealth = health;
                damage    = 10;
                speed     = 7;
                state     = 0x00;
                break;
            }

            default:
            {
                animFly = new List <Rectangle>
                {
                    new Rectangle(95, 0, 25, 27),
                    new Rectangle(120, 0, 25, 27),
                    new Rectangle(145, 0, 25, 27)
                };


                health    = 5;
                maxHealth = health;
                damage    = 10;
                speed     = 5;
                state     = 0x00;
                break;
            }
            }   // end switch

            sprite = new Sprite(texture, animFly[2], 2.0);
        }
Exemple #34
0
 public Ship(ShipType typeOfShip)
 {
     this.OccupiedPoints = new List <Point>();
     this.Type           = typeOfShip;
     this.ShipLength     = (int)Type;
 }
Exemple #35
0
 // returns true if the ship could move there or not
 public bool CanMoveTo(ShipType shipType, int x, int y)
 {
     return(false);
 }
Exemple #36
0
        private bool IsDestroyed(ShipType ship, Cell targetCell)
        {
            var c = ship.ToString()[0];

            return(!_board.Any(x => x == c));
        }
Exemple #37
0
 /// <summary>
 /// Instantiates an Invader object from a ShipType, a location, and a score.
 /// </summary>
 /// <param name="invaderType">The type of invader ship.</param>
 /// <param name="location">The invader's starting location</param>
 /// <param name="score">The invader's score (points a player gets for killing it).</param>
 public InvaderGrunt(ShipType invaderType, Point location, int score) : base(invaderType, location, score)
 {
     InitializeInvaderImages(InvaderType);
     image = invaderImages[0];
 } // end constructor method InvaderGrunt
Exemple #38
0
 public IShip CreateShip(ShipType type)
 {
     return(_shipFactories[type]());
 }
Exemple #39
0
 public void CmdDoSetShipType(ShipType type)
 {
     this.type = type;
 }
Exemple #40
0
        private void promptForShipPlacement(Player p)
        {
            // Prompt each player to set up boards for 5 ships
            // with a starting Coordinate and direction and clear screen afterwards

            ShipType shipType = new ShipType();

            for (int i = 1; i < 6; i++)
            {
                switch (i)
                {
                case 1:
                default:
                    shipType = ShipType.Battleship;
                    break;

                case 2:
                    shipType = ShipType.Carrier;
                    break;

                case 3:
                    shipType = ShipType.Cruiser;
                    break;

                case 4:
                    shipType = ShipType.Destroyer;
                    break;

                case 5:
                    shipType = ShipType.Submarine;
                    break;
                }
                displayCurrentBoardState(p.PlayerBoard);
                Coordinate       shipCoordinate = _gameInput.promptForCoordinate("{0}, Please place your " + shipType + " (Ex/ A6, B8) (Column(A-J) & Row(1-10)): ", p.Name);
                PlaceShipRequest placeShip      = new PlaceShipRequest()
                {
                    Coordinate = shipCoordinate,
                    ShipType   = shipType,
                    Direction  = _gameInput.shipDirection()
                };
                var response = p.PlayerBoard.PlaceShip(placeShip);
                switch (response)
                {
                case ShipPlacement.Ok:
                    Console.WriteLine("Ship placed. Press any key to continue.");
                    break;

                case ShipPlacement.NotEnoughSpace:
                    Console.WriteLine("There is not enough space. Press Any Key and Try again.");
                    i--;
                    break;

                case ShipPlacement.Overlap:
                    Console.WriteLine("The ships are overlapping. Press Any Keey and Try a different coordinate.");
                    i--;
                    break;

                default:
                    break;
                }
                Console.ReadLine();
                Console.Clear();
            }
        }
Exemple #41
0
        /// <summary>
        /// Next wave method
        /// </summary>
        private void nextWave()
        {
            // Make sure the invaders is all cleared
            //if (invaders.Count > 1)
            //{
            //	foreach (Invader invader in invaders)
            //	{
            //		invaders.Remove(invader);
            //	}
            //}
            invaders.Clear();

            wave++;
            Random rnd = new Random(); //Lee: Created the random generator and the IF-ELSE statement so that when a new wave begins,

            if (rnd.Next(0, 2) == 0)   // it will start moving either to the left or the right (random).
            {
                invaderDirection = Direction.Left;
            }
            else
            {
                invaderDirection = Direction.Right;
            }
            // if the wave is under 7, set frames skipped to 6 - current wave number
            if (wave < 7)
            {
                framesSkipped = 6 - wave;
            }
            else
            {
                framesSkipped = 0;
            }
            //if (wave == 3 || wave == 6) {
            //	int currentAlienYSpace = 0;
            //    for (int x = 0; x < 5; x++)
            //    {
            //        Alien currentAlien = (Alien)x;
            //        currentAlienYSpace += alienYSpacing;
            //        int currentAlienXSpace = 120; //Lee: Changed this value from 0, so the invaders will start in the middle of the screen
            //        for (int y = 0; y < 5; y++)
            //        {
            //            currentAlienXSpace += alienXSpacing;
            //            Point newAleinPoint =
            //              new Point(currentAlienXSpace, currentAlienYSpace);
            //            alien newAlien =
            //                new Alien(currentAlienType, newAlienPoint, 10);
            //            alien.Add(newAlien);
            //            playerShots.Clear(); //Lee: Added these two lines to ensure that the
            //            alienShots.Clear();//map is cleared of bullets when a new wave begins
            //}
            //}
            //}
            //else {
            //
            //}

            int currentInvaderYSpace = 0;

            for (int x = 0; x < 5; x++)
            {
                ShipType currentInvaderType = (ShipType)x;
                currentInvaderYSpace += invaderYSpacing;
                int currentInvaderXSpace = 120; //Lee: Changed this value from 0, so the invaders will start in the middle of the screen
                for (int y = 0; y < 5; y++)
                {
                    currentInvaderXSpace += invaderXSpacing;
                    Point newInvaderPoint =
                        new Point(currentInvaderXSpace, currentInvaderYSpace);
                    // Need to add more varied invader score values
                    Invader newInvader =
                        new Invader(currentInvaderType, newInvaderPoint, 10);
                    invaders.Add(newInvader);
                    playerShots.Clear();  //Lee: Added these two lines to ensure that the
                    invaderShots.Clear(); //map is cleared of bullets when a new wave begins
                    bossShots.Clear();
                }
            }
        }
Exemple #42
0
 public Texture2D this[ShipType ship, ShipTier tier]
 {
     get { return(_bulletTextures[new KeyValuePair <ShipType, ShipTier>(ship, tier)]); }
 }
Exemple #43
0
 public Ship(ShipType type, string designame)
 {
     Type         = type;
     DesignName   = designame;
     ShipPosition = Vector3.zero;
 }
 public static int GetShipSellPrice(ShipType ship)
 {
     return((int)(GetShipPrice(ship) * deedSellMult));
 }
Exemple #45
0
 public void GeneratePurchaseShipPopup(ShipType shipType)
 {
     GeneratePopup(DaggerfallBankManager.PurchaseShip(shipType, regionIndex));
 }
 public static uint GetShipModelId(ShipType ship)
 {
     return(ship >= 0 ? shipModelIds[(int)ship] : 0);
 }
Exemple #47
0
 private ShotResult RegisterHit(ShipType ship, Cell targetCell)
 {
     _board[targetCell.ToBoardIndex()] = 'H';
     return(new ShotResult(ship, IsDestroyed(ship, targetCell)));
 }
 public static float GetShipCameraDist(ShipType ship)
 {
     return(ship >= 0 ? shipCameraDist[(int)ship] : 0);
 }
 public MyEventShipCompleted(MyFaction faction, ShipType ship) : base(false)
 {
     Faction = faction;
     Ship    = ship;
 }
 public bool CanBeAddedSafely(ShipType ship, CellPosition start, bool vertical)
 {
     return(CanBeAddedSafely(ship, start, vertical, x => true));
 }
Exemple #51
0
 // returns the cost of the ship moving to location
 public float MoveCost(ShipType shipType, int x, int y)
 {
     return(0.0f);
 }
 public bool TryAddFullShip(ShipType ship, CellPosition start, bool vertical)
 {
     return(TryEditFullShip(ship, start, vertical, true));
 }
Exemple #53
0
 // Смена типа или количества кораблика
 public void Change(ShipType AShipType, int ACount)
 {
     FScript.Change(AShipType, ACount);
 }
 public bool TryRemoveFullShip(ShipType ship, CellPosition start, bool vertical)
 {
     return(TryEditFullShip(ship, start, vertical, false));
 }
Exemple #55
0
 public static int MaxNumber(ShipType type) =>
 type switch
 {
Exemple #56
0
 public Ship(ShipType shipType, int numberOfSlots)
 {
     ShipType       = shipType;
     _lifeRemaining = numberOfSlots;
     BoardPositions = new Coordinates[numberOfSlots];
 }
Exemple #57
0
 public static string ToTypeName(this ShipType type)
 => type.Id == 8 ? "巡洋戦艦" : type.Name;
Exemple #58
0
 //copy-constructor
 public Ship(other)
 {
     Type         = other.Type;
     DesignName   = other.DesignName;
     ShipPosition = Vector3.zero;
 }
Exemple #59
0
        public static ShipType UserTypeShip(Board x, int Count)
        {
            ShipType ship = new ShipType();

            Console.WriteLine("Enter a Ship type");
            string typeofship = ConsoleInput.ReadLine();


            if (typeofship == "Destroyer" || typeofship == "destroyer")
            {
                ship = ShipType.Destroyer;
            }
            else if (typeofship == "Submarine" || typeofship == "submarine")
            {
                ship = ShipType.Submarine;
            }
            else if (typeofship == "Cruiser" || typeofship == "cruiser")
            {
                ship = ShipType.Cruiser;
            }
            else if (typeofship == "Battleship" || typeofship == "battleship")
            {
                ship = ShipType.Battleship;
            }
            else if (typeofship == "Carrier" || typeofship == "carrier")
            {
                ship = ShipType.Carrier;
            }
            else
            {
                Console.WriteLine("Invalid Ship type, try again");
                UserTypeShip(x, Count);
            }


            for (int i = Count; i < 5; i++)
            {
                if (Count == 1)
                {
                    if (x.Ships[i - 1].ShipType == ship)
                    {
                        Console.WriteLine("You've got a duplicate ship, try again!");
                        ship = UserTypeShip(x, Count);
                    }
                }
                else if (Count == 2)
                {
                    if ((x.Ships[i - 1].ShipType == ship) || (x.Ships[i - 2].ShipType == ship))
                    {
                        Console.WriteLine("You've got a duplicate ship, try again!");
                        ship = UserTypeShip(x, Count);
                    }
                }
                else if (Count == 3)
                {
                    if ((x.Ships[i - 1].ShipType == ship) || (x.Ships[i - 2].ShipType == ship) || (x.Ships[i - 3].ShipType == ship))
                    {
                        Console.WriteLine("You've got a duplicate ship, try again!");
                        ship = UserTypeShip(x, Count);
                    }
                }
                else if (Count == 4)
                {
                    if ((x.Ships[i - 1].ShipType == ship) || (x.Ships[i - 2].ShipType == ship) || (x.Ships[i - 3].ShipType == ship) || (x.Ships[i - 4].ShipType == ship))
                    {
                        Console.WriteLine("You've got a duplicate ship, try again!");
                        ship = UserTypeShip(x, Count);
                    }
                }
                break;
            }



            return(ship);
        }
Exemple #60
0
 protected ShipCategory(GameObjectName goName, SpriteBaseName sName, ShipType type, int idx)
     : base(goName, sName, idx)
 {
     this.type = type;
 }