-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShip.cs
137 lines (135 loc) · 3.99 KB
/
Ship.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*Gavin Rodgers and Louis Rodriguez
* 3309 Battleship project III
* This is the Ship class that handles all ship counters and decrements
* Last Edited: 11/7/18
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace Battleship.Classes
{
class Ship
{
//counter set for each one of the 10 ships made in the game
private int carrierAclick = 5;
private int battleshipAclick = 4;
private int cruiserAclick = 3;
private int submarineAclick = 3;
private int destroyerAclick = 2;
private int carrierBclick = 5;
private int battleshipBclick = 4;
private int cruiserBclick = 3;
private int submarineBclick = 3;
private int destroyerBclick = 2;
//attribute for ship name called in
private string shipname;
//constructor that calls in ship name and length for each object
public Ship(string name,int length)
{
shipname = name;
}
//decrements carrier placement amount in Board A
public void CarrierADecrement()
{
carrierAclick--;
}
//checks Carrier Count of Board A
public int CarrierACount()
{
return carrierAclick;
}
//decrements carrier placement amount in Board B
public void CarrierBDecrement()
{
carrierBclick--;
}
//checks Carrier Count of Board B
public int CarrierBCount()
{
return carrierBclick;
}
//decrements Battleship placement amount in Board A
public void BattleshipADecrement()
{
battleshipAclick--;
}
//checks Battleship Count of Board A
public int BattleshipACount()
{
return battleshipAclick;
}
//decrements Battleship placement amount in Board B
public void BattleshipBDecrement()
{
battleshipBclick--;
}
//checks Carrier Count of Board B
public int BattleshipBCount()
{
return battleshipBclick;
}
//decrements Cruiser placement amount in Board A
public void CruiserADecrement()
{
cruiserAclick--;
}
//checks Cruiser Count of Board A
public int CruiserACount()
{
return cruiserAclick;
}
//decrements Cruiser placement amount in Board B
public void CruiserBDecrement()
{
cruiserBclick--;
}
//checks Cruiser Count of Board B
public int CruiserBCount()
{
return cruiserBclick;
}
//decrements Submarine placement amount in Board A
public void SubmarineADecrement()
{
submarineAclick--;
}
//checks Submarine Count of Board A
public int SubmarineACount()
{
return submarineAclick;
}
//decrements Submarine placement amount in Board B
public void SubmarineBDecrement()
{
submarineBclick--;
}
//checks Submarine Count of Board B
public int SubmarineBCount()
{
return submarineBclick;
}
//decrements Destroyer placement amount in Board A
public void DestroyerADecrement()
{
destroyerAclick--;
}
//checks Destroyer Count of Board A
public int DestroyerACount()
{
return destroyerAclick;
}
//decrements Destroyer placement amount in Board B
public void DestroyerBDecrement()
{
destroyerBclick--;
}
//checks Destroyer Count of Board B
public int DestroyerBCount()
{
return destroyerBclick;
}
}
}