예제 #1
0
        //同じ高さかチェック
        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);
        }
예제 #2
0
        //位置関係から角度
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
 public MapPathNode(int nodeNo, MapNodePlate plate)
 {
     this.plate  = plate;
     this.nodeNo = nodeNo;
 }