Ejemplo n.º 1
0
        public void swapNeo()
        {
            Cell n   = whereIsNeo();
            int  neX = n.getx();
            int  neY = n.gety();

            int newX = Usefuls.random_Number(0, 5);
            int newY = Usefuls.random_Number(0, 5);

            if (this.board[newX, newY] != null)
            {
                if (this.board[newX, newY] is Smith)
                {
                    Smith aux = (Smith)this.board[newX, newY];
                    this.board[newX, newY] = this.neo;
                    this.board[neX, neY]   = aux;
                }
                else
                {
                    Personages aux = this.board[newX, newY];
                    this.board[newX, newY] = this.neo;
                    this.board[neX, neY]   = aux;
                }
            }
            else
            {
                this.board[newX, newY] = this.neo;
                this.board[neX, neY]   = null;
            }
        }
Ejemplo n.º 2
0
        public void actionPg()
        {
            int cont = 0;

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    if (!(this.board[i, j] is Neo) && !(this.board[i, j] is Smith))
                    {
                        if (this.board[i, j] != null)
                        {
                            Personages p   = this.board[i, j];
                            int        per = p.getPercentageDie();

                            if (per > 70)
                            {
                                if (this.queue.Count() > 0)
                                {
                                    this.board[i, j] = this.queue.Dequeue();
                                }
                                else
                                {
                                    this.board[i, j] = null;
                                }
                                cont++;
                            }
                            else
                            {
                                p.setPercentageDie(per + 10);
                            }
                        }
                    }
                }
            }

            Console.WriteLine("Kill: " + cont);
            Console.WriteLine();
        }