|
|
@ -80,7 +80,7 @@ public class Player : MonoBehaviour |
|
|
foreach (MapUnity mapUnity in influencePreviewPool) |
|
|
foreach (MapUnity mapUnity in influencePreviewPool) |
|
|
{ |
|
|
{ |
|
|
mapUnity.PlayerInfluenced(influencePreviewPool); |
|
|
mapUnity.PlayerInfluenced(influencePreviewPool); |
|
|
mapUnity.playerMark.meshRenderer.material = mapUnity.red; |
|
|
mapUnity.playerMark.material = mapUnity.red; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
//StepPreviewInfluencedNode(GameManager.Instance.playerState.currentStepRange);
|
|
|
//StepPreviewInfluencedNode(GameManager.Instance.playerState.currentStepRange);
|
|
|
@ -365,380 +365,6 @@ public class Player : MonoBehaviour |
|
|
anim.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); |
|
|
anim.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
public void StepPreviewInfluencedNode(int step)//可移动格子预览
|
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Clear(); |
|
|
|
|
|
//GameManager.Instance.playerOn.InfluencePool = GameManager.Instance.playerOn.unitPool;
|
|
|
|
|
|
MapUnity playerNode = GameManager.Instance.playerOn; |
|
|
|
|
|
MapUnity currentNode = GameManager.Instance.playerOn; |
|
|
|
|
|
MapUnity xRememberNode = GameManager.Instance.playerOn; |
|
|
|
|
|
//Vector2 currentPoint = new Vector2(currentNode.locationX, currentNode.locationY);
|
|
|
|
|
|
//Vector2 surchPoint = new Vector2(currentNode.locationX, currentNode.locationY-step);
|
|
|
|
|
|
|
|
|
|
|
|
//迭代六次-逆时针
|
|
|
|
|
|
//向左
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[0] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[0];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[5] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[5]); |
|
|
|
|
|
currentNode = currentNode.unitPool[5]; |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向左下
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[5] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[5];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[4] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[4]); |
|
|
|
|
|
currentNode = currentNode.unitPool[4]; |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向右
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[4] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[4];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[3] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[3]); |
|
|
|
|
|
currentNode = currentNode.unitPool[3]; |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向右上
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[3] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[3];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[2] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[2]); |
|
|
|
|
|
currentNode = currentNode.unitPool[2]; |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向上
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[2] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[2];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[1] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[1]); |
|
|
|
|
|
currentNode = currentNode.unitPool[1]; |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向左上
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[1] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[1];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[0] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[0]); |
|
|
|
|
|
currentNode = currentNode.unitPool[0]; |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//迭代六次-顺时针
|
|
|
|
|
|
//向左
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[5] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[5];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[0] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
if(currentNode.influenced==false) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[0]); |
|
|
|
|
|
currentNode = currentNode.unitPool[0]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向左下
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[4] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[4];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[5] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.influenced == false) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[5]); |
|
|
|
|
|
currentNode = currentNode.unitPool[5]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向右
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[3] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[3];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[4] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.influenced == false) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[4]); |
|
|
|
|
|
currentNode = currentNode.unitPool[4]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向右上
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[2] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[2];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[3] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.influenced == false) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[3]); |
|
|
|
|
|
currentNode = currentNode.unitPool[3]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向上
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[1] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[1];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[2] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.influenced == false) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[2]); |
|
|
|
|
|
currentNode = currentNode.unitPool[2]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//向左上
|
|
|
|
|
|
xRememberNode = playerNode;//记忆标量归位
|
|
|
|
|
|
for (int j = 0; j < step; j++) |
|
|
|
|
|
{ |
|
|
|
|
|
// surchPoint.y = currentNode.locationY+j+1;
|
|
|
|
|
|
// surchPoint.x = currentNode.locationX;
|
|
|
|
|
|
if (j != 0) |
|
|
|
|
|
{ |
|
|
|
|
|
if (xRememberNode.unitPool[0] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
xRememberNode = xRememberNode.unitPool[0];//延迟一步
|
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
currentNode = xRememberNode; |
|
|
|
|
|
|
|
|
|
|
|
for (int k = 0; k < step - j; k++) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.unitPool[1] != null) |
|
|
|
|
|
{ |
|
|
|
|
|
if (currentNode.influenced == false) |
|
|
|
|
|
{ |
|
|
|
|
|
influencePreviewPool.Add(currentNode.unitPool[1]); |
|
|
|
|
|
currentNode = currentNode.unitPool[1]; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//遍历影响池变色
|
|
|
|
|
|
foreach (MapUnity mapUnity in influencePreviewPool) |
|
|
|
|
|
{ |
|
|
|
|
|
mapUnity.PlayerInfluenced(influencePreviewPool); |
|
|
|
|
|
mapUnity.playerMark.meshRenderer.material = mapUnity.red; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 计算贝塞尔曲线的拟合点
|
|
|
#region 计算贝塞尔曲线的拟合点
|
|
|
public List<Vector3> CalculatePath(List <Vector3 > linePath , float posCount,Vector3 lineStart,Vector3 lineMiddel,Vector3 lineEnd) |
|
|
public List<Vector3> CalculatePath(List <Vector3 > linePath , float posCount,Vector3 lineStart,Vector3 lineMiddel,Vector3 lineEnd) |
|
|
|