//同じ高さかチェック bool IsWalkable(MapNodePlate target) { enAngle angle = GetAngle(target); enAngle tagAngle = RevAngle(angle); float myY = this.stY + GetAngleHeight((EnumShapeType)this.shapeType, angle); float tagY = target.stY + GetAngleHeight((EnumShapeType)target.shapeType, tagAngle); //Debug.Log("myY"+ myY + "tagY" + tagY); return(myY == tagY); }
//位置関係から角度 enAngle GetAngle(MapNodePlate target) { enAngle res = enAngle.Same; if (this.stX < target.stX) { if (this.stZ < target.stZ) { res = enAngle.BackRight; } else if (this.stZ > target.stZ) { res = enAngle.FrontRight; } else { res = enAngle.Right; } } else if (this.stX > target.stX) { if (this.stZ < target.stZ) { res = enAngle.BackLeft; } else if (this.stZ > target.stZ) { res = enAngle.FrontLeft; } else { res = enAngle.Left; } } else { if (this.stZ < target.stZ) { res = enAngle.Back; } else if (this.stZ > target.stZ) { res = enAngle.Front; } else { res = enAngle.Same; } } return(res); }
public bool IsSideBySide(MapNodePlate target) { //距離が隣ではない if (Mathf.Abs(this.stX - target.stX) > 1) { return(false); } if (Mathf.Abs(this.stZ - target.stZ) > 1) { return(false); } //高さチェック bool isWalkable = IsWalkable(target); return(isWalkable); }
public bool IsJumpable(MapNodePlate target) { //距離が隣ではない int distX = Mathf.Abs(this.stX - target.stX); int distZ = Mathf.Abs(this.stZ - target.stZ); const int MAXJUMPDISTXZ = 3; const int MAXJUMPDISTXZ_SQ = MAXJUMPDISTXZ * MAXJUMPDISTXZ; //ジャンプで届く距離 if (((distX * distX) + (distZ * distZ)) > MAXJUMPDISTXZ_SQ) { return(false); } //高すぎチェック const int MAXDISTH = 3; if (this.stY < (target.stY - MAXDISTH)) { return(false); } return(true); }
public MapPathNode(int nodeNo, MapNodePlate plate) { this.plate = plate; this.nodeNo = nodeNo; }