Example #1
0
 public bool MoveWest(int distance = 1, MatrixConstraints mb = MatrixConstraints.NONE)
 {
     if (CanMove(LookWest(distance), mb))
     {
         //transform.position = LookWest(distance);
         return(true);
     }
     return(false);
 }
Example #2
0
 /// <summary>
 /// Returns true if <paramref name="row"/>, <paramref name="col"/>, <paramref name="elev"/> (matrix space) is in the same spot
 /// as <paramref name="b"/>.
 /// </summary>
 /// <param name="row">The row.</param>
 /// <param name="col">The col.</param>
 /// <param name="elev">The elev.</param>
 /// <param name="b">The b.</param>
 /// <param name="mb">The mb.</param>
 /// <param name="ignoreHeight">if set to <c>true</c> [ignore height].</param>
 /// <returns></returns>
 public static bool SameSpot(int row, int col, int elev, OmniBehaviour b, MatrixConstraints mb = MatrixConstraints.ALL, bool ignoreHeight = false)
 {
     return(mb != MatrixConstraints.NONE && (((mb & MatrixConstraints.ROW) == MatrixConstraints.ROW) ? row == b.ROWINDEX : true) && (((mb & MatrixConstraints.COL) == MatrixConstraints.COL) ? col == b.COLINDEX : true) && (((mb & MatrixConstraints.HEIGHT) == MatrixConstraints.HEIGHT) ? (elev == b.HEIINDEX || ignoreHeight) : true));
 }
Example #3
0
 public static bool SameSpot(OmniBehaviour a, OmniBehaviour b, MatrixConstraints mb = MatrixConstraints.ALL, bool ignoreHeight = false)
 {
     return(mb != MatrixConstraints.NONE && (((mb & MatrixConstraints.ROW) == MatrixConstraints.ROW) ? a.ROWINDEX == b.ROWINDEX : true) && (((mb & MatrixConstraints.COL) == MatrixConstraints.COL) ? a.COLINDEX == b.COLINDEX : true) && (((mb & MatrixConstraints.HEIGHT) == MatrixConstraints.HEIGHT) ? (a.HEIINDEX == b.HEIINDEX || ignoreHeight) : true));
 }
Example #4
0
 public virtual bool CanMove(Vector3 pos, MatrixConstraints mb = MatrixConstraints.NONE)
 {
     pos = Indexify(pos, indexScale);
     return(!Map || mb == MatrixConstraints.NONE || ((!((mb & MatrixConstraints.ROW) == MatrixConstraints.ROW) || pos.x >= 0 && pos.x < Map.Row) && (!((mb & MatrixConstraints.COL) == MatrixConstraints.COL) || pos.z >= 0 && pos.z < Map.Column) && (!((mb & MatrixConstraints.HEIGHT) == MatrixConstraints.HEIGHT) || pos.y >= 0 && pos.y < Map.Height)));
 }
Example #5
0
 public bool CanMoveFree(Vector3 pos, MatrixConstraints mb = MatrixConstraints.NONE)
 {
     return(CanMove(POS + pos, mb));
 }
Example #6
0
 public bool MoveDown(int distance = 1, MatrixConstraints mb = MatrixConstraints.NONE)
 {
     return(CanMove(LookDown(distance), mb));
 }
Example #7
0
 public bool MoveSouthWest(int distance = 1, MatrixConstraints mb = MatrixConstraints.NONE)
 {
     return(CanMove(LookSouthWest(distance), mb));
 }
Example #8
0
 // changing move North changes South
 public bool MoveNorthEast(int distance = 1, MatrixConstraints mb = MatrixConstraints.NONE)
 {
     return(CanMove(LookNorthEast(distance), mb));
 }
Example #9
0
 public bool MoveBackward(int distance = 1, MatrixConstraints mb = MatrixConstraints.NONE)
 {
     return(CanMove(LookBackward(distance), mb));
 }