コード例 #1
0
 public static bool contains(this iRlStage self, Vec2i pos) =>
 self.bounds.contains(pos);
コード例 #2
0
 // TODO: consider both entities and tiles
 public bool isDiagonallyPassingForEntity(Vec2i from, Dir9 dir, bool isDiaPassed)
 {
     return(isDiaPassed || dir.isCardinal || new [] { dir.xVec, dir.yVec }
            .Select(v => v.offset(from))
            .All(p => !this.cx.stage.isBlocked(p)));
 }
コード例 #3
0
 Dir9(Vec2i offset) : this(offset.x, offset.y)
 {
 }
コード例 #4
0
 Dir9(int x, int y)
 {
     mVec = new Vec2i(x.clamp(-1, 1), y.clamp(-1, 1));
 }
コード例 #5
0
 // from size
 public Rect2Di(Vec2i size) : this(Vec2i.zero, size)
 {
 }
コード例 #6
0
 // TODO: make cache
 public static Dir9 fromVec2i(Vec2i v) => Dir9.clockwise.FirstOrDefault(d => v == d.vec);
コード例 #7
0
 public Rect2Di(Vec2i pos, int width, int height) : this(pos, new Vec2i(width, height))
 {
 }
コード例 #8
0
 public Rect2Di(int x, int y, Vec2i size) : this(new Vec2i(x, y), size)
 {
 }
コード例 #9
0
        public static Rect2Di centerIn(Rect2Di toCenter, Rect2Di main)
        {
            Vec2i pos = main.leftUp + ((main.size - toCenter.size) / 2);

            return(new Rect2Di(pos, toCenter.size));
        }
コード例 #10
0
 public Rect2Di(Vec2i pos, Vec2i size)
 {
     mPos  = pos;
     mSize = size;
 }
コード例 #11
0
 public static Rect2Di col(Vec2i pos, int h) => new Rect2Di(pos.x, pos.y, 1, h);
コード例 #12
0
 public static Rect2Di row(Vec2i pos, int w) => new Rect2Di(pos.x, pos.y, w, 1);
コード例 #13
0
 public bool contains(Vec2i pos) => this.contains(pos.x, pos.y);
コード例 #14
0
 public Rect2Di offset(Vec2i pos, Vec2i size)
 {
     return(new Rect2Di(mPos + pos, mSize + size));
 }
コード例 #15
0
 public Body setPos(Vec2i pos)
 {
     this.pos = pos;
     return(this);
 }