diff --git a/Assets/Scripts/General/Data.cs b/Assets/Scripts/General/Data.cs index 3574d35..a75f325 100644 --- a/Assets/Scripts/General/Data.cs +++ b/Assets/Scripts/General/Data.cs @@ -289,6 +289,22 @@ public class PlacementInfo public Robot[] Robots = new Robot[Const.RobotsPerTeam]; public Ball Ball = new Ball(); + public void PlacementInfoFromMatchInfo(MatchInfo matchInfo,Side side) + { + Ball = matchInfo.Ball; + if(side == Side.Blue) + { + Robots = (Robot[])matchInfo.BlueRobots.Clone(); + } + else if(side == Side.Yellow) + { + Robots = (Robot[])matchInfo.YellowRobots.Clone(); + } + else + { + Debug.Log("flase"); + } + } public void Normalize() { // TODO 保证不会出界、不会重叠 diff --git a/Assets/Scripts/Scene/Play/PlayMain.cs b/Assets/Scripts/Scene/Play/PlayMain.cs index 55f67cd..85f845e 100644 --- a/Assets/Scripts/Scene/Play/PlayMain.cs +++ b/Assets/Scripts/Scene/Play/PlayMain.cs @@ -572,6 +572,8 @@ void UpdatePlacementToScene(JudgeResult judgeResult) currentMatchInfo.UpdateFrom(blueInfo.Robots, Side.Blue); //先进行第一次摆位判罚 GlobalMatchInfo.Referee.JudgeAutoPlacement(currentMatchInfo, judgeResult, Side.Blue); + //判罚后将蓝方信息更新 + blueInfo.PlacementInfoFromMatchInfo(currentMatchInfo, Side.Blue); // 黄方后摆位 yellowInfo = StrategyManager.Yellow.GetPlacement(currentMatchInfo.GetSide(Side.Yellow)); // 黄方策略认为自己是蓝方,所以返回数据之后需要转换 @@ -582,7 +584,8 @@ void UpdatePlacementToScene(JudgeResult judgeResult) //进行第二次裁判判罚 GlobalMatchInfo.Referee.JudgeAutoPlacement(currentMatchInfo, judgeResult, Side.Yellow); - + //判罚后对黄方信息更新 + yellowInfo.PlacementInfoFromMatchInfo(currentMatchInfo, Side.Yellow); break; } case Side.Yellow: @@ -594,7 +597,9 @@ void UpdatePlacementToScene(JudgeResult judgeResult) // 将黄方返回的数据同步到currMi currentMatchInfo.UpdateFrom(yellowInfo.Robots, Side.Yellow); //进行第一次摆位判罚 - GlobalMatchInfo.Referee.JudgeAutoPlacement(currentMatchInfo, judgeResult, Side.Blue); + GlobalMatchInfo.Referee.JudgeAutoPlacement(currentMatchInfo, judgeResult, Side.Yellow); + //判罚之后将黄方信息更新 + yellowInfo.PlacementInfoFromMatchInfo(currentMatchInfo,Side.Yellow); // 蓝方后摆位 blueInfo = StrategyManager.Blue.GetPlacement(currentMatchInfo.GetSide(Side.Blue)); @@ -602,6 +607,8 @@ void UpdatePlacementToScene(JudgeResult judgeResult) currentMatchInfo = new MatchInfo(blueInfo, yellowInfo, judgeResult.Actor); //进行第二次裁判判罚 GlobalMatchInfo.Referee.JudgeAutoPlacement(currentMatchInfo, judgeResult, Side.Blue); + //判罚之后将蓝方信息更新 + blueInfo.PlacementInfoFromMatchInfo(currentMatchInfo, Side.Blue); } break;