protected override void determinePos(BouleSnake bs) { if (compteur > 0) { base.determinePos(bs); } }
protected override void determinePos(BouleSnake bs) { if (!fin) { base.determinePos(bs); } }
protected override void determinePos(BouleSnake bs) { if (!fin || partiesSnake.Count < hauteurJeu * largeurJeu) { base.determinePos(bs); } }
protected virtual void ajouteCorps() { BouleSnake lastBS = partiesSnake[partiesSnake.Count - 1]; int nouvPosX = lastBS.posX, nouvPosY = lastBS.posY; partiesSnake.Add(new CorpsSnake(nouvPosX, nouvPosY)); labelTaille.Text = "Taille : " + partiesSnake.Count; }
protected virtual bool verifPos(BouleSnake bs) { bool posCorrecte = verifPosPomme(bs); posCorrecte = posCorrecte && verifPosPartie(bs); return(posCorrecte); }
protected virtual void determinePos(BouleSnake bs) { bool posCorrecte = true; do { bs.posX = tirageRandLargeur(); bs.posY = tirageRandHauteur(); posCorrecte = verifPos(bs); } while(!posCorrecte); }
protected bool verifPosPartie(BouleSnake bs) { foreach (BouleSnake boule in partiesSnake) { if (boule.posX == bs.posX && boule.posY == bs.posY) { return(false); } } return(true); }
protected bool verifPosPiege(BouleSnake bs) { foreach (PiegeSnake ps in listePiege) { if (bs.posX == ps.posX && bs.posY == ps.posY) { return(false); } } return(true); }
protected bool verifPosPomme(BouleSnake bs) { foreach (BonusSnake bonus in listeBonus) { if (bs.posX == bonus.posX && bs.posY == bonus.posY && bs != bonus) { return(false); } } return(true); }
protected override bool verifPos(BouleSnake bs) { bool posCorrecte = base.verifPos(bs) && verifPosPiege(bs); return(posCorrecte); }