本文整理汇总了C#中AcademyPopcorn.MatrixCoords类的典型用法代码示例。如果您正苦于以下问题:C# MatrixCoords类的具体用法?C# MatrixCoords怎么用?C# MatrixCoords使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MatrixCoords类属于AcademyPopcorn命名空间,在下文中一共展示了MatrixCoords类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrailObject
// The new constructor
public TrailObject(MatrixCoords matrixCoord, uint turns)
: base(matrixCoord, new char[,] { {Symbol} })
{
if (turns == 0)
throw new ArgumentException("Turns of the trailing object must be a positive integer number.");
this.turns = turns;
}
示例2: GiftBlock
public GiftBlock(MatrixCoords topLeft, Gift gift)
: base(topLeft)
{
this.CurrentGift = gift;
this.CurrentGift.SetTopLeft(topLeft);
this.body = new char[,] { { GiftBlock.Symbol } };
}
示例3: Print
public void Print(List<dynamic> infoBar, MatrixCoords topLeft)
{
for (int line = 0; line < infoBar.Count; line++)
{
Console.SetCursorPosition(topLeft.Col, topLeft.Row + line);
Console.WriteLine(infoBar[line]);
}
}
示例4: BulletRacket
private int shotsLeft; // Bullet Racket has limmited number of shots
#endregion Fields
#region Constructors
public BulletRacket(MatrixCoords topLeft, int width)
: base(topLeft, width)
{
this.body[0, 0] = '!'; // draw left gun
this.body[0, this.body.GetLength(1)-1] = '!'; // draw right gun
this.shotsLeft = 10; // Bullet Racket has only 10 shots loaded
hasShooted = false;
}
示例5: TrailObject
public TrailObject(MatrixCoords topLeft, char[,] body, int lifeTime)
: base(topLeft, body, new MatrixCoords(0,0))
{
if (lifeTime <= 0)
{
throw new IndexOutOfRangeException("The life time can not be negative");
}
this.lifeTime = lifeTime;
}
示例6: Update
public void Update(MatrixCoords coords)
{
this.Lifetime--;
if (this.Lifetime <= 0)
{
this.IsDestroyed = true;
}
this.topLeft = coords;
}
示例7: ProduceObjects
public override IEnumerable<GameObject> ProduceObjects()
{
List<GameObject> produced = new List<GameObject>();
if (this.IsDestroyed)
{
MatrixCoords newRacketCoords = new MatrixCoords(this.TopLeft.Row + 1, this.TopLeft.Col);
produced.Add(new ShootingRacket(newRacketCoords, 6));
}
return produced;
}
示例8: TrailObject
public TrailObject(MatrixCoords topLeft, char[,] body, int lifeTime)
: base(topLeft, body)
{
this.TopLeft = topLeft;
int imageRows = body.GetLength(0);
int imageCols = body.GetLength(1);
this.body = body;
this.IsDestroyed = false;
this.LifeTime = lifeTime;
}
示例9: TrailObject
public TrailObject(MatrixCoords topLeft, char[,] body, int lifetime)
: base(topLeft, body)
{
if (lifetime < 1)
{
throw new ArgumentOutOfRangeException("Life time can not be less then 1.");
}
this.lifetime = lifetime;
}
示例10: CollisionData
public CollisionData(MatrixCoords collisionForceDirection, List<string> hitObjectsCollisionGroupStrings)
{
this.CollisionForceDirection = collisionForceDirection;
this.hitObjectsCollisionGroupStrings = new List<string>();
foreach (var str in hitObjectsCollisionGroupStrings)
{
this.hitObjectsCollisionGroupStrings.Add(str);
}
}
示例11: GameObject
protected GameObject(MatrixCoords topLeft, char[,] body)
{
this.TopLeft = topLeft;
int imageRows = body.GetLength(0);
int imageCols = body.GetLength(1);
this.body = this.CopyBodyMatrix(body);
this.IsDestroyed = false;
}
示例12: ProduceObjects
public override IEnumerable<GameObject> ProduceObjects()
{
if (this.IsDestroyedByRacket)
{
// TODO create fire racket
var racketTopLeft = new MatrixCoords(this.topLeft.Row + 1, this.topLeft.Col);
var racket = new ShootingRacket(racketTopLeft, 6);
return new GameObject[] { racket };
}
return base.ProduceObjects();
}
示例13: Run
public virtual void Run(List<dynamic> list, MatrixCoords topLeft)
{
while (true)
{
// Print every object over the screen
this.renderer.RenderAll();
// Set game speed
System.Threading.Thread.Sleep(520 - 5 * Speed);
// Check for user input
this.userInterface.ProcessInput();
// Clear all objects from the screen
this.renderer.ClearQueue();
// For each objects the new position is updated
foreach (var obj in this.allObjects)
{
obj.Update();
this.renderer.EnqueueForRendering(obj);
}
// Check for collisions
CollisionDispatcher.HandleCollisions(this.movingObjects, this.staticObjects);
// Check for produced objects
List<GameObject> producedObjects = new List<GameObject>();
foreach (var obj in this.allObjects)
{
producedObjects.AddRange(obj.ProduceObjects(playerRacket.TopLeft.Col));
}
// Delete all dead objects
this.allObjects.RemoveAll(obj => obj.IsDestroyed);
this.movingObjects.RemoveAll(obj => obj.IsDestroyed);
this.staticObjects.RemoveAll(obj => obj.IsDestroyed);
// Add all produced objects in the list
foreach (var obj in producedObjects)
{
this.AddObject(obj);
}
// Print the information field
Infofield infoField = new Infofield();
infoField.Print(list, topLeft);
}
}
示例14: ProduceObjects
public override IEnumerable<GameObject> ProduceObjects()
{
if (this.CanShoot)
{
this.CanShoot = false;
int col = this.topLeft.Col + (this.Width / 2);
var bulletTopLeft = new MatrixCoords(this.topLeft.Row, col);
var bullet = new Bullet(bulletTopLeft);
return new GameObject[] { bullet };
}
return base.ProduceObjects();
}
示例15: GetBlock
public static Block GetBlock(int type, MatrixCoords coords)
{
switch (type)
{
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
return new Block(coords);
case 7:
return new UnpassableBlock(coords);
case 8:
return new GiftBlock(coords);
case 9:
return new ExplodingBlock(coords);
default:
return new Block(coords);
}
}