示例#1
0
        public void ArtificialIntelligence(BARRIER barrier)
        {
            while (true)
            {
                try
                {
                    this.rnd = new Random();
                    this.Move(this.rnd.Next(-1, 1), this.rnd.Next(-1, 1), barrier);
                }
                catch
                {
                    Console.WriteLine("there can not move");
                }

                break;
            }
        }
示例#2
0
        public void Move(int x, int y, BARRIER barrier)
        {
            if (!(barrier.X == this.X + x) & !(barrier.Y == this.Y + y))
            {
                if (x >= base.X & x <= 0)
                {
                    throw new Exception("object can not be located abroad, error x");
                }

                if (y >= base.Y & y <= 0)
                {
                    throw new Exception("object can not be located abroad, error y");
                }

                this.X = x;
                this.Y = y;
            }
        }
示例#3
0
        public void Move(int x, int y, BARRIER barrier, BONUS bonus)
        {
            if (!(barrier.X == this.X + x) & !(barrier.Y == this.Y + y))
            {
                if (x >= base.X & x <= 0)
                {
                    throw new Exception("player can not be located abroad, error x");
                }

                if (y >= base.Y & y <= 0)
                {
                    throw new Exception("player can not be located abroad, error y");
                }

                this.X = x;
                this.Y = y;
            }

            if (bonus.X == this.X + x & bonus.Y == this.Y + y)
            {
                this.Speed      += bonus.Speedincrease;
                this.Effecttime += bonus.Effecttime;
            }
        }