Ejemplo n.º 1
0
 public AsciiObject(char[][] chars, char emptyChar, int x, int y, int z = 0, GridCollideMethod collideMethod = GridCollideMethod.Ignore, AsciiVector vector = null)
 {
     Chars    = Utils.CreateObject(chars, emptyChar);
     X        = x;
     Y        = y;
     Collider = new AsciiCollider(Width, Height, collideMethod);
     Vector   = vector ?? AsciiVector.Zero;
 }
Ejemplo n.º 2
0
 public static float GetCollisionMultiplier(float rawLength, int gridLength, GridCollideMethod collideMethod)
 {
     return(collideMethod switch
     {
         GridCollideMethod.Ignore => 1,
         GridCollideMethod.Reflect => rawLength >= gridLength ? -1 : 1,
         GridCollideMethod.Scroll => 1,
         GridCollideMethod.Stop => rawLength >= gridLength ? 0 : 1,
         _ => 1
     });
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new <see cref="AsciiObject"/> with a specified string value, separator character, empty character, and its initial X and Y values.
 /// </summary>
 public AsciiObject(string value, char separatorChar, char emptyChar, int x, int y, int z = 0, GridCollideMethod collideMethod = GridCollideMethod.Ignore, AsciiVector vector = null)
 {
     Chars    = Utils.CreateObject(value, separatorChar, emptyChar);
     X        = x;
     Y        = y;
     Z        = z;
     Collider = new AsciiCollider(Width, Height, collideMethod);
     Vector   = vector ?? AsciiVector.Zero;
 }
Ejemplo n.º 4
0
 public void CreateAndAddObject(string value, char separatorChar, int x, int y, int z = 0, GridCollideMethod collideMethod = GridCollideMethod.Ignore, AsciiVector vector = null)
 {
     Objects.Add(new AsciiObject(value, separatorChar, EmptyChar, x, y, z, collideMethod, vector));
 }
Ejemplo n.º 5
0
 public void CreateAndAddObject(char[][] chars, int x, int y, int z = 0, GridCollideMethod collideMethod = GridCollideMethod.Ignore, AsciiVector vector = null)
 {
     Objects.Add(new AsciiObject(chars, EmptyChar, x, y, z, collideMethod, vector));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates a new <see cref="AsciiCollider"/> with the specified width, height, and method.
 /// </summary>
 public AsciiCollider(int width, int height, GridCollideMethod method = GridCollideMethod.Ignore)
 {
     Width        = width;
     Height       = height;
     GridCollider = method;
 }