|
|
@@ -86,7 +86,7 @@ public abstract class Move
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- protected Func<SpineAnimationLoader, Vector2, bool, bool> IsUIBlock = (SpineAnimationLoader target, Vector2 pos, bool log) =>
|
|
|
+ protected Func<SpineAnimationLoader, Vector2, MoveType, bool, bool> IsUIBlock = (SpineAnimationLoader target, Vector2 pos, MoveType moveType, bool log) =>
|
|
|
{
|
|
|
var radius = target.Radius();
|
|
|
|
|
|
@@ -103,29 +103,35 @@ public abstract class Move
|
|
|
if (log)
|
|
|
Debug.Log($"pos={pos} paddingLeft={paddingLeft} paddingTop={paddingTop} paddingRight={paddingRight} paddingDown={paddingDown}");
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- ////上方170 右方133
|
|
|
- //if (paddingTop <= 170 && paddingRight <= 133)
|
|
|
- // return true;
|
|
|
-
|
|
|
- ////下148 左方 370
|
|
|
- //if (paddingDown <= 148f && paddingLeft <= 370)
|
|
|
- // return true;
|
|
|
-
|
|
|
+ //if(moveType == MoveType.Stay || moveType.)
|
|
|
//需要对称屏蔽
|
|
|
|
|
|
- //上方 左方
|
|
|
- if ((paddingDown <= 164 || paddingTop <= 164) && (paddingLeft <= 372 || paddingRight <= 372))
|
|
|
- return true;
|
|
|
+ if (false)
|
|
|
+ {
|
|
|
+ //上方 左方
|
|
|
+ if ((paddingDown <= 164 || paddingTop <= 164) && (paddingLeft <= 372 || paddingRight <= 372))
|
|
|
+ return true;
|
|
|
|
|
|
- //下 右方
|
|
|
- if ((paddingDown <= 108 || paddingTop <= 108) && (paddingRight <= 134 || paddingLeft <= 134))
|
|
|
- return true;
|
|
|
+ //下 右方
|
|
|
+ if ((paddingDown <= 108 || paddingTop <= 108) && (paddingRight <= 134 || paddingLeft <= 134))
|
|
|
+ return true;
|
|
|
|
|
|
- //右方 133
|
|
|
- if (paddingRight <= 133 || paddingLeft <= 133)
|
|
|
- return true;
|
|
|
+ //右方 133
|
|
|
+ if (paddingRight <= 133 || paddingLeft <= 133)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //上方 左方
|
|
|
+ if (paddingTop <= 164 && paddingLeft <= 372)
|
|
|
+ return true;
|
|
|
+ //下 右方
|
|
|
+ if (paddingDown <= 108 && paddingRight <= 134)
|
|
|
+ return true;
|
|
|
+ //右方 133
|
|
|
+ if (paddingRight <= 133 || paddingLeft <= 133)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
return false;
|
|
|
};
|
|
|
@@ -174,7 +180,7 @@ public class Stay : Move
|
|
|
{
|
|
|
var randomPos = gos[i].GetRandomPos();
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) || (CheckOverLap(gos[i], randomPos) && count > 0))
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.Stay, false) || (CheckOverLap(gos[i], randomPos) && count > 0))
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos();
|
|
|
count--;
|
|
|
@@ -185,30 +191,30 @@ public class Stay : Move
|
|
|
var HHeight = canvasSize.y * 0.5f;
|
|
|
var canUse = false;
|
|
|
var newPos = Vector2.zero;
|
|
|
- for (int xPos = 0; xPos <= HWidth - 200f; xPos += 20)
|
|
|
+ for (int xPos = 0; xPos <= HWidth * 0.7f; xPos += 20)
|
|
|
{
|
|
|
- for (int yPos = 0; yPos < HHeight - 150f; yPos += 15)
|
|
|
+ for (int yPos = 0; yPos < HHeight * 0.7f; yPos += 15)
|
|
|
{
|
|
|
newPos.x = xPos; newPos.y = yPos;
|
|
|
- if (!IsUIBlock(gos[i], newPos, false) && !CheckOverLap(gos[i], newPos))
|
|
|
+ if (!IsUIBlock(gos[i], newPos, MoveType.Stay, false) && !CheckOverLap(gos[i], newPos))
|
|
|
{
|
|
|
canUse = true;
|
|
|
break;
|
|
|
}
|
|
|
newPos.x = xPos; newPos.y = -yPos;
|
|
|
- if (!IsUIBlock(gos[i], newPos, false) && !CheckOverLap(gos[i], newPos))
|
|
|
+ if (!IsUIBlock(gos[i], newPos, MoveType.Stay, false) && !CheckOverLap(gos[i], newPos))
|
|
|
{
|
|
|
canUse = true;
|
|
|
break;
|
|
|
}
|
|
|
newPos.x = -xPos; newPos.y = yPos;
|
|
|
- if (!IsUIBlock(gos[i], newPos, false) && !CheckOverLap(gos[i], newPos))
|
|
|
+ if (!IsUIBlock(gos[i], newPos, MoveType.Stay, false) && !CheckOverLap(gos[i], newPos))
|
|
|
{
|
|
|
canUse = true;
|
|
|
break;
|
|
|
}
|
|
|
newPos.x = -xPos; newPos.y = -yPos;
|
|
|
- if (!IsUIBlock(gos[i], newPos, false) && !CheckOverLap(gos[i], newPos))
|
|
|
+ if (!IsUIBlock(gos[i], newPos, MoveType.Stay, false) && !CheckOverLap(gos[i], newPos))
|
|
|
{
|
|
|
canUse = true;
|
|
|
break;
|
|
|
@@ -241,7 +247,7 @@ public class LeftToRight : Move, IUpdate
|
|
|
{
|
|
|
var randomPos = gos[i].GetRandomPos(PosType.Left);
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) || CheckOverLap(gos[i], randomPos, MoveType.LeftToRight) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.LeftToRight, false) || CheckOverLap(gos[i], randomPos, MoveType.LeftToRight) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(PosType.Left);
|
|
|
count--;
|
|
|
@@ -267,7 +273,7 @@ public class RightToLeft : Move
|
|
|
{
|
|
|
var randomPos = gos[i].GetRandomPos(PosType.Right);
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) || CheckOverLap(gos[i], randomPos, MoveType.RightToLeft) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.RightToLeft, false) || CheckOverLap(gos[i], randomPos, MoveType.RightToLeft) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(PosType.RightDown);
|
|
|
count--;
|
|
|
@@ -294,7 +300,7 @@ public class RelativeHor : Move
|
|
|
var tempPos = i % 2 == 0 ? PosType.LeftDown : PosType.RightDown;
|
|
|
var randomPos = gos[i].GetRandomPos(tempPos);
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) || CheckOverLap(gos[i], randomPos, MoveType.RelativeHor, gos.Count) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.RelativeHor, false) || CheckOverLap(gos[i], randomPos, MoveType.RelativeHor, gos.Count) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(tempPos);
|
|
|
count--;
|
|
|
@@ -321,7 +327,7 @@ public class RelativeVet : Move
|
|
|
var tempPos = i % 2 == 0 ? PosType.Top : PosType.Down;
|
|
|
var randomPos = gos[i].GetRandomPos(tempPos);
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) || CheckOverLap(gos[i], randomPos, MoveType.RelativeVet, gos.Count) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.RelativeVet, false) || CheckOverLap(gos[i], randomPos, MoveType.RelativeVet, gos.Count) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(tempPos);
|
|
|
count--;
|
|
|
@@ -356,7 +362,7 @@ public class Diagonal : Move
|
|
|
var randomPos = gos[i].GetRandomPos(posType, 0.25f);
|
|
|
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.Diagonal, false) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(posType, 0.25f);
|
|
|
count--;
|
|
|
@@ -384,7 +390,7 @@ public class W : Move
|
|
|
var tempPos = i % 2 == 0 ? PosType.LeftTop : PosType.LeftDown;
|
|
|
var randomPos = gos[i].GetRandomPos(tempPos, 0.25f);
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.W, false) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(tempPos, 0.25f);
|
|
|
count--;
|
|
|
@@ -427,7 +433,7 @@ public class W2 : Move
|
|
|
|
|
|
var randomPos = gos[i].GetRandomPos(tempPos, 0.25f);
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.W2, false) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(tempPos, 0.25f);
|
|
|
count--;
|
|
|
@@ -460,7 +466,7 @@ public class HOR : Move
|
|
|
{
|
|
|
var randomPos = gos[i].GetRandomPos(tempPos);
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) || CheckOverLap(gos[i], randomPos) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.HOR, false) || CheckOverLap(gos[i], randomPos) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(tempPos);
|
|
|
count--;
|
|
|
@@ -488,7 +494,7 @@ public class VET : Move
|
|
|
{
|
|
|
var randomPos = gos[i].GetRandomPos(tempPos);
|
|
|
int count = RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) || CheckOverLap(gos[i], randomPos) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.VET, false) || CheckOverLap(gos[i], randomPos) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(tempPos);
|
|
|
count--;
|
|
|
@@ -514,7 +520,7 @@ public class ROT : Move, IUpdate
|
|
|
{
|
|
|
var randomPos = gos[i].GetRandomPos(PosType.Rotate);
|
|
|
int count = 2 * RamdomNum;
|
|
|
- while (IsUIBlock(gos[i], randomPos, false) || CheckOverLap(gos[i], randomPos) && count > 0)
|
|
|
+ while (IsUIBlock(gos[i], randomPos, MoveType.ROT, false) || CheckOverLap(gos[i], randomPos) && count > 0)
|
|
|
{
|
|
|
randomPos = gos[i].GetRandomPos(PosType.Rotate);
|
|
|
count--;
|