示例#1
0
 public DynamicObject(Position topLeft, char[,] texture, int speed, Direction direction)
     : base(topLeft, texture)
 {
     this.Speed = speed;
     this.state = this.Speed;
     this.ObjDirection = direction;
 }
示例#2
0
 // Ship can shoot
 public List<GameObject> Shoot(Direction direction)
 {
     List<GameObject> shoots = new List<GameObject>();
     Position bulletPosition = new Position(0, 0);
     char bulletTexture = '|';
     switch (direction)
     {
         case Direction.Top:
             bulletPosition.Row = this.TopLeft.Row - 1;
             bulletPosition.Col = (2 * this.TopLeft.Col + this.Width) / 2;
             bulletTexture = '|';
             break;
         case Direction.TopRight:
             bulletPosition.Row = this.TopLeft.Row - 1;
             bulletPosition.Col = this.TopLeft.Col + 1;
             bulletTexture = '/';
             break;
         case Direction.Right:
             bulletPosition.Row = (2 * this.TopLeft.Row + this.Width) / 2;
             bulletPosition.Col = this.TopLeft.Col + 1;
             bulletTexture = '-';
             break;
         case Direction.DownRight:
             bulletPosition.Row = this.TopLeft.Row + 2;
             bulletPosition.Col = this.TopLeft.Col + 1;
             bulletTexture = '\\';
             break;
         case Direction.Down:
             bulletPosition.Row = this.TopLeft.Row + 2;
             bulletPosition.Col = (2 * this.TopLeft.Col + this.Width) / 2;
             bulletTexture = '|';
             break;
         case Direction.DownLeft:
             bulletPosition.Row = this.TopLeft.Row + 2;
             bulletPosition.Col = this.TopLeft.Col - 1;
             bulletTexture = '/';
             break;
         case Direction.Left:
             bulletPosition.Row = (2 * this.TopLeft.Row + this.Width) / 2;
             bulletPosition.Col = this.TopLeft.Col + 1;
             bulletTexture = '-';
             break;
         case Direction.TopLeft:
             bulletPosition.Row = this.TopLeft.Row - 1;
             bulletPosition.Col = this.TopLeft.Col - 1;
             bulletTexture = '\\';
             break;
         default:
             break;
     }
     shoots.Add(new Bullet(bulletPosition,new char[,] { { bulletTexture } }, direction));
     return shoots;
 }
示例#3
0
 public StaticObject(Position topLeft, char[,] texture)
     : base(topLeft, texture)
 {
 }
示例#4
0
 // Main abstract class for all objects
 public GameObject(Position topLeft, char[,] texture)
 {
     this.TopLeft = topLeft;
     this.Texture = texture;
     this.IsDestroyed = false;
 }
示例#5
0
 //Constructor
 public Ship(Position topLeft, char[,] texture, int speed, Direction direction, int life)
     : base(topLeft, texture,speed,direction)
 {
     this.Life = life;
 }
示例#6
0
 public Bullet(Position topLeft, char[,] texture, Direction bulletDirection)
     : base(topLeft, texture,0,bulletDirection)
 {
     this.ObjDirection = bulletDirection;
 }
示例#7
0
 public Rock(Position topLeft, char[,] body)
     : base(topLeft, body)
 {
     this.Lifetime = 100;
 }
示例#8
0
 //Constructor
 public EnemyShip(Position center, char[,] texture,Direction direction)
     : base(center, texture,5,direction,2)
 {
     this.ObjectPosition = center;
 }
示例#9
0
 // The Viking
 //changed viking outlook yoan
 public Viking(Position topLeft)
     : base(topLeft, new char[,] { {' ',' ','^',' ',' '}, {'-','[','*',']','-'}},0,Direction.Right,5)
 {
 }