Esempio n. 1
0
        private void shipHitEvent(Event ev)
        {
            ShipHitEvent shipHitEvent = (ShipHitEvent)ev;
            Player       owner        = shipHitEvent.Ship.Owner; //who owns the hit ship

            // We only care about hits on enemy ships
            if (owner != Player)
            {
                // An opponent's ship has been hit
                this.hit(shipHitEvent.HitCoords, shipHitEvent.Ship.IsSunk());
            }
        }
Esempio n. 2
0
        private void shipHit(Event ev) {
            ShipHitEvent shipHitEvent = (ShipHitEvent)ev;

            Player owner = shipHitEvent.Ship.Owner;
            if (owner != Player) {

                bool sink = shipHitEvent.Ship.IsSunk();
                Coordinates coords = shipHitEvent.HitCoords;

                bot.shipHit(coords, sink);
            } else {
                //other player has made a hit
            }
        }
Esempio n. 3
0
        private void ASCIIUpdateShotHit(Event ev)
        {
            ShipHitEvent shipEvent = (ShipHitEvent)ev;

            ModifyASCII(shipEvent.Ship.Owner.ID, shipEvent.HitCoords.X, shipEvent.HitCoords.Y, ' ', ConsoleColor.White, ConsoleColor.Yellow);
        }