static bool muzeSeOtocit(Souradnice souradnice, NatoceniLode uhel, TypLode lod) { if (lod == TypLode.Clun) { if (uhel == NatoceniLode.Stupnu0) { if (souradnice.X >= 0 || souradnice.Y + 1 <= herniPoleY.Length || souradnice.X <= herniPoleX.Length || souradnice.Y > 0) { return(true); } else { return(false); } } if (uhel == NatoceniLode.Stupnu90) { if (souradnice.X >= 0 || souradnice.Y <= herniPoleY.Length || souradnice.X + 1 <= herniPoleX.Length || souradnice.Y > 0) { return(true); } else { return(false); } } if (uhel == NatoceniLode.Stupnu180) { if (souradnice.X >= 0 || souradnice.Y + 1 <= herniPoleY.Length || souradnice.X <= herniPoleX.Length || souradnice.Y > 0) { return(true); } else { return(false); } } if (uhel == NatoceniLode.Stupnu270) { if (souradnice.X >= 0 || souradnice.Y <= herniPoleY.Length || souradnice.X + 1 <= herniPoleX.Length || souradnice.Y > 0) { return(true); } else { return(false); } } } return(false); }
public Lod(TypLode typ) { Typ = typ; Policka = new List <Souradnice>(); switch (Typ) { case TypLode.Clun: Policka.Add(new Souradnice { X = 0, Y = 0 }); Policka.Add(new Souradnice { X = 0 + 1, Y = 0 }); break; case TypLode.Torpedovka: Policka.Add(new Souradnice { X = 0, Y = 0 }); Policka.Add(new Souradnice { X = 0 - 1, Y = 0 }); Policka.Add(new Souradnice { X = 0 + 1, Y = 0 }); Policka.Add(new Souradnice { X = 0, Y = 0 + 1 }); break; case TypLode.Letadlovka: Policka.Add(new Souradnice { X = 0, Y = 0 }); Policka.Add(new Souradnice { X = 0 - 1, Y = 0 }); Policka.Add(new Souradnice { X = 0 + 1, Y = 0 }); Policka.Add(new Souradnice { X = 0 + 2, Y = 0 }); Policka.Add(new Souradnice { X = 0, Y = 0 + 1 }); Policka.Add(new Souradnice { X = 0 + 1, Y = 0 + 1 }); break; case TypLode.Kriznik: Policka.Add(new Souradnice { X = 0, Y = 0 }); Policka.Add(new Souradnice { X = 0 - 1, Y = 0 }); Policka.Add(new Souradnice { X = 0 + 1, Y = 0 }); Policka.Add(new Souradnice { X = 0 + 2, Y = 0 }); break; } }
public Lod(TypLode typ) { throw new NotImplementedException(); }