Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace hitGame
{
class Program
{
int life = 10;
int revengeBar = 0;
int powerBar = 0;
//3 methods for Punch
public int lowPunch()
{
life -= 6;
powerBar = 6 / 2;
revengeBar = 6 / 2;
return life;
}
public int midPunch()
{
life -= 9;
powerBar = 9 / 2;
revengeBar = 9 / 2;
return life;
}
public int highPunch()
{
life -= 11;
powerBar = 11 / 2;
revengeBar = 11 / 2;
return life;
}
char d = Console.ReadKey().KeyChar;
Console.WriteLine();
Console.WriteLine();
if (hitChoice == 1 || hitChoice == 4)
{
if (d == 'C')
{
defense = true;
}
}
else if (hitChoice == 2 || hitChoice == 5)
{
if (d == 'B')
{
defense = true;
}
}
else if (hitChoice == 3 || hitChoice == 6)
{
if (d == 'A')
{
defense = true;
}
}
else if (hitChoice == 7 || hitChoice == 8)
{
if (d == 'E')
{
defense = true;
}
}
// attack method calls if defense got failed
if (defense == false)
{
switch (hitChoice)
{
case 1:
{
p1.lowPunch();
break;
}
case 2:
{
p1.midPunch();
break;
}
case 3:
{
p1.highPunch();
break;
}
case 4:
{
p1.lowKick();
break;
}
case 5:
{
p1.midKick();
break;
}
case 6:
{
p1.highKick();
break;
}
case 7:
{
if (p2.powerBar >= 100)
p1.superAttack4();