Exemple #1
0
 public Body(Vec2i pos, Dir9 dir, bool isBlocker, bool isDiagonalBlocker = false)
 {
     this.location          = Location.OnStage;
     this.pos               = pos;
     this.facing            = dir;
     this.isBlocker         = isBlocker;
     this.isDiagonalBlocker = isDiagonalBlocker;
 }
Exemple #2
0
        // TODO: separate it in a static class
        public bool canWalkIn(Entity e, Dir9 dir)
        {
            var body = e.get <Body>();

            if (this.isBlockingForEntities(body.pos + dir.vec))
            {
                return(false);
            }
            return(isDiagonallyPassingForEntity(body.pos, dir, RlLogicPreferences.doEnableCornerWalk));
        }
Exemple #3
0
        public override void DrawMutable()
        {
            var dir = base.GetValue <Dir9>();

            if (dir == null)
            {
                if (ImGui.Button("Create Object"))
                {
                    dir = Dir9.fromXy(1, 0);
                    base.SetValue(dir);
                }
            }
            else
            {
                ImGui.LabelText("dir", dir.ToString());
            }
        }
Exemple #4
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)));
 }
Exemple #5
0
 /// <summary> Considers diagonal attack </summary>
 public bool canAttackIn(Entity e, Dir9 dir)
 {
     return(isDiagonallyPassingForEntity(e.get <Body>().pos, dir, RlLogicPreferences.doEnableCornerAttack));
 }
Exemple #6
0
 public static EDir8 toEDir8(this Dir9 self) => (EDir8)self.asIndexClockwise;
Exemple #7
0
 public static EDir8 fromDir9(Dir9 dir) => (EDir8)dir.asIndexClockwise;
Exemple #8
0
 public Body setDir(Dir9 dir)
 {
     this.facing = dir;
     return(this);
 }