diff --git a/Assets/Battle Soup AI/Core/Data.cs b/Assets/Battle Soup AI/Core/Data.cs index 9b232ad..1e34fff 100644 --- a/Assets/Battle Soup AI/Core/Data.cs +++ b/Assets/Battle Soup AI/Core/Data.cs @@ -18,6 +18,77 @@ public Int2 (int x, int y) { this.x = x; this.y = y; } + public static Int2 operator + (Int2 a, Int2 b) { + a.x += b.x; + a.y += b.y; + return a; + } + public static Int2 operator - (Int2 a, Int2 b) { + a.x -= b.x; + a.y -= b.y; + return a; + } + public static Int2 operator * (Int2 a, Int2 b) { + a.x *= b.x; + a.y *= b.y; + return a; + } + public static Int2 operator / (Int2 a, Int2 b) { + a.x /= b.x; + a.y /= b.y; + return a; + } + public static Int2 operator * (Int2 a, int b) { + a.x *= b; + a.y *= b; + return a; + } + public static Int2 operator / (Int2 a, int b) { + a.x /= b; + a.y /= b; + return a; + } + public override string ToString () => $"({x},{y})"; + } + + + public struct Float2 { + public float x; + public float y; + public Float2 (float x, float y) { + this.x = x; + this.y = y; + } + public static Float2 operator + (Float2 a, Float2 b) { + a.x += b.x; + a.y += b.y; + return a; + } + public static Float2 operator - (Float2 a, Float2 b) { + a.x -= b.x; + a.y -= b.y; + return a; + } + public static Float2 operator * (Float2 a, Float2 b) { + a.x *= b.x; + a.y *= b.y; + return a; + } + public static Float2 operator / (Float2 a, Float2 b) { + a.x /= b.x; + a.y /= b.y; + return a; + } + public static Float2 operator * (Float2 a, float b) { + a.x *= b; + a.y *= b; + return a; + } + public static Float2 operator / (Float2 a, float b) { + a.x /= b; + a.y /= b; + return a; + } } @@ -250,7 +321,7 @@ public bool Symmetry { // API - public (Int2 min, Int2 max) GetBounds (ShipPosition pos) { + public (Int2 min, Int2 max) GetBounds (bool flip) { int minX = int.MaxValue; int minY = int.MaxValue; int maxX = int.MinValue; @@ -261,7 +332,7 @@ public bool Symmetry { maxX = System.Math.Max(maxX, v.x); maxY = System.Math.Max(maxY, v.y); } - return pos.Flip ? + return flip ? (new Int2(minY, minX), new Int2(maxY, maxX)) : (new Int2(minX, minY), new Int2(maxX, maxY)); } diff --git a/Assets/Battle Soup AI/Core/SoupStrategy.cs b/Assets/Battle Soup AI/Core/SoupStrategy.cs index fc4c530..14cf1e9 100644 --- a/Assets/Battle Soup AI/Core/SoupStrategy.cs +++ b/Assets/Battle Soup AI/Core/SoupStrategy.cs @@ -27,6 +27,8 @@ public int AliveShipCount { public int[] Cooldowns; public bool[] ShipsAlive; public ShipPosition?[] KnownPositions; + public List Sonars; + } @@ -82,7 +84,7 @@ public abstract class SoupStrategy { // Data private int[,] RIP_ValuesCache = null; private int[,,] RIP_ValuesCacheAlt = null; - private static System.Random Random = new System.Random(); + protected static System.Random Random = new System.Random(); #endregion @@ -163,7 +165,7 @@ public static bool PositionShips_Random (int mapSize, Ship[] ships, Int2[] stone // Func bool PositionAvailable (Ship _ship, ShipPosition _pos) { // Border Check - var (min, max) = _ship.GetBounds(_pos); + var (min, max) = _ship.GetBounds(_pos.Flip); if (_pos.Pivot.x < -min.x || _pos.Pivot.x > mapSize - max.x - 1 || _pos.Pivot.y < -min.y || _pos.Pivot.y > mapSize - max.y - 1 ) { @@ -520,66 +522,6 @@ int Exposure (Ship _ship, ShipPosition _sPos) { } - public bool GetTileMVP (float[,,] values, Tile[,] tiles, Tile filter, out Int2 pos) => GetTileMVP(values, tiles, filter, Tile.None, out pos); - public bool GetTileMVP (float[,,] values, Tile[,] tiles, Tile filter, Tile neighbourFilter, out Int2 pos) => GetTileMVP(values, tiles, filter, neighbourFilter, null, out pos); - public bool GetTileMVP (float[,,] values, Tile[,] tiles, Tile filter, Tile neighbourFilter, List attacks, out Int2 pos) { - int size = tiles.GetLength(0); - int valueIndex = values.GetLength(0) - 1; - bool hasAttacks = attacks != null && attacks.Count > 0; - float maxValue = 0; - bool success = false; - bool neighbour = neighbourFilter != Tile.None; - pos = default; - for (int j = 0; j < size; j++) { - for (int i = 0; i < size; i++) { - var tile = tiles[i, j]; - if (!filter.HasFlag(tile)) { continue; } - float value = GetValue(i, j); - if (value > maxValue || (value == maxValue && Random.NextDouble() > 0.66666f)) { - maxValue = value; - pos.x = i; - pos.y = j; - success = true; - } - } - } - return success; - // Func - float GetValue (int _i, int _j) { - float result = values[valueIndex, _i, _j]; - if (neighbour) { - if (!hasAttacks) { - // Default Cross - if (_i - 1 >= 0 && neighbourFilter.HasFlag(tiles[_i - 1, _j])) { - result += values[valueIndex, _i - 1, _j]; - } - if (_j - 1 >= 0 && neighbourFilter.HasFlag(tiles[_i, _j - 1])) { - result += values[valueIndex, _i, _j - 1]; - } - if (_i + 1 < size && neighbourFilter.HasFlag(tiles[_i + 1, _j])) { - result += values[valueIndex, _i + 1, _j]; - } - if (_j + 1 < size && neighbourFilter.HasFlag(tiles[_i, _j + 1])) { - result += values[valueIndex, _i, _j + 1]; - } - } else { - // Attacks - foreach (var att in attacks) { - if (att.Trigger == AttackTrigger.PassiveRandom || att.Trigger == AttackTrigger.Random) { continue; } - int _x = _i + att.X; - int _y = _j + att.Y; - if (_x < 0 || _x >= size || _y < 0 || _y >= size) { continue; } - var _tile = tiles[_x, _y]; - if (!att.AvailableTarget.HasFlag(_tile) || !neighbourFilter.HasFlag(_tile)) { continue; } - result += values[valueIndex, _x, _y]; - } - } - } - return result; - } - } - - public int GetShipWithMinimalPotentialPosCount (BattleInfo info, List[] hiddenPositions, List[] exposedPositions) => GetShipWithMinimalPotentialPosCount(info, hiddenPositions, exposedPositions, out _); @@ -728,6 +670,70 @@ public int CountNeighborTile (Tile[,] tiles, int x, int y, Tile filter) { } + public bool AveragePosition (Tile[,] tiles, Tile filter, out Float2 pos) { + Float2? resultPos = null; + int size = tiles.GetLength(0); + float count = 0f; + pos = default; + for (int j = 0; j < size; j++) { + for (int i = 0; i < size; i++) { + var tile = tiles[i, j]; + if (!filter.HasFlag(tile)) { continue; } + if (!resultPos.HasValue) { + resultPos = new Float2(i, j); + } else { + resultPos += new Float2(i, j); + } + count++; + } + } + if (resultPos.HasValue && count > 0) { + resultPos /= count; + pos = resultPos.Value; + return true; + } else { + return false; + } + } + + + public bool NearestPosition (Tile[,] tiles, int x, int y, Tile filter, out Int2 pos, out float sqrtDistance) { + pos = default; + sqrtDistance = float.MaxValue; + int size = tiles.GetLength(0); + bool success = false; + for (int j = 0; j < size; j++) { + for (int i = 0; i < size; i++) { + var tile = tiles[i, j]; + if (!filter.HasFlag(tile)) { continue; } + float a = System.Math.Abs(x - i); + float b = System.Math.Abs(y - j); + float sqrtDis = a * a + b * b; + if (sqrtDis < sqrtDistance) { + sqrtDistance = sqrtDis; + pos.x = i; + pos.y = j; + success = true; + } + } + } + return success; + } + + + public bool ContainsTile (Tile[,] tiles, Tile filter) { + int size = tiles.GetLength(0); + for (int j = 0; j < size; j++) { + for (int i = 0; i < size; i++) { + if (filter.HasFlag(tiles[i, j])) { + return true; + } + } + } + return false; + } + + #endregion diff --git a/Assets/Battle Soup AI/Core/SoupStrategy_Advanced.cs b/Assets/Battle Soup AI/Core/SoupStrategy_Advanced.cs index 1194abb..2e4d62a 100644 --- a/Assets/Battle Soup AI/Core/SoupStrategy_Advanced.cs +++ b/Assets/Battle Soup AI/Core/SoupStrategy_Advanced.cs @@ -6,6 +6,14 @@ namespace BattleSoupAI { public abstract class SoupStrategy_Advanced : SoupStrategy { + // SUB + public enum MVPConfig { + Hidden = 0, + Exposed = 1, + Both = 2, + } + + // Data protected int OwnAliveShipCount = 0; protected int OpponentAliveShipCount = 0; @@ -241,5 +249,89 @@ public bool TryAttackShip (BattleInfo info, int targetIndex, Tile filter, out In } + public bool GetTileMVP (Tile[,] tiles, Tile filter, MVPConfig config, out Int2 pos) => GetTileMVP(tiles, filter, Tile.None, config, out pos); + public bool GetTileMVP (Tile[,] tiles, Tile filter, Tile neighbourFilter, MVPConfig config, out Int2 pos) => GetTileMVP(tiles, filter, neighbourFilter, null, config, out pos, out _); + public bool GetTileMVP (Tile[,] tiles, Tile filter, Tile neighbourFilter, List attacks, MVPConfig config, out Int2 pos, out AbilityDirection direcion) { + var hdValues = HiddenValues; + var exValues = ExposedValues; + int size = tiles.GetLength(0); + int valueIndex = hdValues.GetLength(0) - 1; + bool hasAttacks = attacks != null && attacks.Count > 0; + float maxValue = 0; + bool success = false; + bool neighbour = neighbourFilter != Tile.None; + pos = default; + direcion = default; + for (int j = 0; j < size; j++) { + for (int i = 0; i < size; i++) { + var tile = tiles[i, j]; + if (!filter.HasFlag(tile)) { continue; } + float value = GetValue(i, j, out var _direcion); + if (value > maxValue || (value == maxValue && Random.NextDouble() > 0.66666f)) { + maxValue = value; + pos.x = i; + pos.y = j; + success = true; + direcion = _direcion; + } + } + } + return success; + // Func + float GetConfigValue (int _i, int _j) { + float result = 0f; + if (config == MVPConfig.Hidden || config == MVPConfig.Both) { + result += hdValues[valueIndex, _i, _j]; + } + if (config == MVPConfig.Exposed || config == MVPConfig.Both) { + result += exValues[valueIndex, _i, _j]; + } + return result; + } + float GetValue (int _i, int _j, out AbilityDirection _dir) { + _dir = default; + float result = GetConfigValue(_i, _j); + if (neighbour) { + if (!hasAttacks) { + // Default Cross + if (_i - 1 >= 0 && neighbourFilter.HasFlag(tiles[_i - 1, _j])) { + result += GetConfigValue(_i - 1, _j); + } + if (_j - 1 >= 0 && neighbourFilter.HasFlag(tiles[_i, _j - 1])) { + result += GetConfigValue(_i, _j - 1); + } + if (_i + 1 < size && neighbourFilter.HasFlag(tiles[_i + 1, _j])) { + result += GetConfigValue(_i + 1, _j); + } + if (_j + 1 < size && neighbourFilter.HasFlag(tiles[_i, _j + 1])) { + result += GetConfigValue(_i, _j + 1); + } + } else { + // Attacks + float attResult = 0f; + for (int i = 0; i < 4; i++) { + float currentResult = 0; + var dir = (AbilityDirection)i; + foreach (var att in attacks) { + if (att.Trigger == AttackTrigger.PassiveRandom || att.Trigger == AttackTrigger.Random) { continue; } + var (_x, _y) = att.GetPosition(_i, _j, dir); + if (_x < 0 || _x >= size || _y < 0 || _y >= size) { continue; } + var _tile = tiles[_x, _y]; + if (!att.AvailableTarget.HasFlag(_tile) || !neighbourFilter.HasFlag(_tile)) { continue; } + currentResult += GetConfigValue(_x, _y); + } + if (currentResult > attResult) { + attResult = currentResult; + _dir = dir; + } + } + result += attResult; + } + } + return result; + } + } + + } } diff --git a/Assets/Battle Soup AI/Strategy/BattleAttacker.cs b/Assets/Battle Soup AI/Strategy/BattleAttacker.cs index e4da9dd..e6a188e 100644 --- a/Assets/Battle Soup AI/Strategy/BattleAttacker.cs +++ b/Assets/Battle Soup AI/Strategy/BattleAttacker.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using System.Linq; namespace BattleSoupAI { @@ -50,27 +51,129 @@ protected override string GetTask (BattleInfo info) { // LGC private AnalyseResult PerformTask_Search (BattleInfo info) { - var result = AnalyseResult.None; - if (TileCount_GeneralWater > (int)(info.MapSize * info.MapSize * 0.618f)) { - // Search with Sea Monster - } else { - // Search with + var result = AnalyseResult.None; + // Search with Sea Monster + if (SeaMonsterCooldown == 0 && TileCount_GeneralWater > (int)(info.MapSize * info.MapSize * 0.618f)) { + result.TargetPosition = default; + result.AbilityIndex = SEAMONSTER_INDEX; + return result; } + // Search with MiniSub + if (MiniSubCooldown == 0) { + + var disCheckFilter = Tile.HittedShip | Tile.RevealedShip | Tile.SunkShip; + bool success = false; + + if (ContainsTile(info.Tiles, disCheckFilter)) { + float maxDis = float.MinValue; + for (int i = 0; i < 4; i++) { + var checkingPos = new Int2( + i < 2 ? 0 : info.MapSize - 1, + i % 2 == 0 ? 0 : info.MapSize - 1 + ); + if ( + CheckCorner(checkingPos.x, checkingPos.y) && + NearestPosition(info.Tiles, checkingPos.x, checkingPos.y, disCheckFilter, out _, out var checkedDis) + ) { + if (checkedDis > maxDis) { + maxDis = checkedDis; + result.TargetPosition = checkingPos; + success = true; + } + } + } + } else { + var filter = Tile.GeneralWater | Tile.GeneralStone; + result.TargetPosition = + filter.HasFlag(info.Tiles[0, 0]) ? new Int2(0, 0) : + filter.HasFlag(info.Tiles[info.MapSize - 1, 0]) ? new Int2(info.MapSize - 1, 0) : + filter.HasFlag(info.Tiles[info.MapSize - 1, info.MapSize - 1]) ? new Int2(info.MapSize - 1, info.MapSize - 1) : + filter.HasFlag(info.Tiles[0, info.MapSize - 1]) ? new Int2(0, info.MapSize - 1) : + default; + success = true; + } + if (success) { + result.AbilityIndex = MINISUB_INDEX; + return result; + } + } + // Search with Normal Attack + var bestHiddenPos = HiddenValueMax[info.Ships.Length].pos; + if ( + info.Tiles[bestHiddenPos.x, bestHiddenPos.y] != Tile.GeneralWater && + !GetFirstTile(info.Tiles, Tile.GeneralWater | Tile.RevealedShip, out bestHiddenPos) + ) { + bestHiddenPos = default; + } + result.TargetPosition = bestHiddenPos; + result.AbilityIndex = -1; return result; + // Func + bool CheckCorner (int x, int y) => + (Tile.GeneralWater | Tile.GeneralStone | Tile.RevealedWater).HasFlag( + info.Tiles[x, y] + ) && !info.Sonars.Any(pos => pos.x == x && pos.y == y); } private AnalyseResult PerformTask_Attack (BattleInfo info) { - var result = AnalyseResult.None; + var result = AnalyseResult.None; + bool mustUseLongboat = UsingAbilityIndex == LONGBOAT_INDEX; + + if (mustUseLongboat || LongBoatCooldown == 0) { + // Attack with Longboat + if ( + TileCount_RevealedShip + TileCount_HittedShip > 0 && + GetTileMVP(info.Tiles, Tile.GeneralWater | Tile.RevealedShip, Tile.None, MVPConfig.Exposed, out var bestLongPos) + ) { + result.AbilityIndex = LONGBOAT_INDEX; + result.TargetPosition = bestLongPos; + return result; + } + } + if (SailBoatCooldown == 0) { + // Attack with Sailboat + var filter = Tile.GeneralWater | Tile.GeneralStone | Tile.RevealedShip; + if (GetTileMVP( + info.Tiles, filter, filter, info.Ships[SAILBOAT_INDEX].Ability.Attacks, + MVPConfig.Both, out var bestSailPos, out var bestDir + )) { + result.AbilityIndex = SAILBOAT_INDEX; + result.TargetPosition = bestSailPos; + result.AbilityDirection = bestDir; + return result; + } + } + // Attack with Normal Attack + if (TryAttackShip( + info, + ShipWithMinimalPotentialPos, + Tile.RevealedShip | Tile.GeneralWater, + out var attPos + )) { + result.TargetPosition = attPos; + result.AbilityIndex = -1; + return result; + } + // Fallback Attack + var bestHiddenPos = HiddenValueMax[info.Ships.Length].pos; + if ( + info.Tiles[bestHiddenPos.x, bestHiddenPos.y] != Tile.GeneralWater && + !GetFirstTile(info.Tiles, Tile.GeneralWater | Tile.RevealedShip, out bestHiddenPos) + ) { + bestHiddenPos = default; + } + result.AbilityIndex = -1; + result.TargetPosition = bestHiddenPos; return result; } diff --git a/Assets/Battle Soup AI/Strategy/RevealAndSnipe.cs b/Assets/Battle Soup AI/Strategy/RevealAndSnipe.cs index b5e9ffb..ba162f4 100644 --- a/Assets/Battle Soup AI/Strategy/RevealAndSnipe.cs +++ b/Assets/Battle Soup AI/Strategy/RevealAndSnipe.cs @@ -90,36 +90,32 @@ private AnalyseResult PerformTask_Search (BattleInfo info) { // Check for Ability if (WhaleCooldown == 0) { // Use Whale - if (GetTileMVP(HiddenValues, info.Tiles, Tile.All, Tile.All, out var bestWhalePos)) { + if (GetTileMVP(info.Tiles, Tile.All, Tile.All, MVPConfig.Hidden, out var bestWhalePos)) { result.TargetPosition = bestWhalePos; result.AbilityIndex = WHALE_INDEX; - LogMessage?.Invoke($"Search/Whale [{result}]"); } else { result.TargetPosition = bestHiddenPos; result.AbilityIndex = -1; - LogMessage?.Invoke($"Search/Normal(Whale Fail) [{result}]"); } } else if (SquidCooldown == 0 && TileCount_RevealedShip + TileCount_RevealedWater > 0) { // Use Squid - if (GetTileMVP(HiddenValues, info.Tiles, Tile.RevealedWater | Tile.RevealedShip, Tile.GeneralWater | Tile.RevealedShip, out var bestSquidPos)) { + if (GetTileMVP(info.Tiles, Tile.RevealedWater | Tile.RevealedShip, Tile.GeneralWater | Tile.RevealedShip, MVPConfig.Hidden, out var bestSquidPos)) { result.TargetPosition = bestSquidPos; result.AbilityIndex = SQUID_INDEX; - LogMessage?.Invoke($"Search/Squid [{result}]"); } else { result.TargetPosition = bestHiddenPos; result.AbilityIndex = -1; - LogMessage?.Invoke($"Search/Normal(Squid Fail) [{result}]"); } } else if (TurtleCooldown == 0) { // Use Turtle result.TargetPosition = bestHiddenPos; result.AbilityIndex = TURTLE_INDEX; - LogMessage?.Invoke($"Search/Turtle [{result}]"); + ////LogMessage?.Invoke($"Search/Turtle [{result}]"); } else { // Use Normal Attack result.TargetPosition = bestHiddenPos; result.AbilityIndex = -1; - LogMessage?.Invoke($"Search/Normal [{result}]"); + ////LogMessage?.Invoke($"Search/Normal [{result}]"); } @@ -143,32 +139,28 @@ private AnalyseResult PerformTask_Reveal (BattleInfo info) { // Check for Ability if (WhaleCooldown == 0) { // Use Whale - if (GetTileMVP(HiddenValues, info.Tiles, Tile.HittedShip, Tile.GeneralWater, out var bestWhalePos)) { + if (GetTileMVP(info.Tiles, Tile.HittedShip, Tile.GeneralWater, MVPConfig.Hidden, out var bestWhalePos)) { result.TargetPosition = bestWhalePos; result.AbilityIndex = WHALE_INDEX; - LogMessage?.Invoke($"Reveal/Whale [{result}]"); } else { - LogMessage?.Invoke("Reveal not performed."); return PerformTask_Attack(info); } } else if (SquidCooldown == 0 && TileCount_RevealedShip + TileCount_RevealedWater > 0) { // Use Squid - if (GetTileMVP(HiddenValues, info.Tiles, Tile.RevealedWater | Tile.RevealedShip, Tile.GeneralWater | Tile.RevealedShip, out var bestSquidPos)) { + if (GetTileMVP(info.Tiles, Tile.RevealedWater | Tile.RevealedShip, Tile.GeneralWater | Tile.RevealedShip, MVPConfig.Hidden, out var bestSquidPos)) { result.TargetPosition = bestSquidPos; result.AbilityIndex = SQUID_INDEX; - LogMessage?.Invoke($"Reveal/Squid [{result}]"); } else { - LogMessage?.Invoke("Reveal not performed."); return PerformTask_Attack(info); } } else if (TurtleCooldown == 0) { // Use Turtle result.TargetPosition = bestHiddenPos; result.AbilityIndex = TURTLE_INDEX; - LogMessage?.Invoke($"Reveal/Turtle [{result}]"); + //LogMessage?.Invoke($"Reveal/Turtle [{result}]"); } else { // Perform Attack - LogMessage?.Invoke("Reveal not performed."); + //LogMessage?.Invoke("Reveal not performed."); return PerformTask_Attack(info); } @@ -212,7 +204,7 @@ private AnalyseResult PerformTask_Attack (BattleInfo info) { if (minSlime < int.MaxValue && (OpponentAliveShipCount <= 2 || minSlime <= 2)) { result.TargetPosition = minPos; result.AbilityIndex = CORACLE_INDEX; - LogMessage?.Invoke($"Attack/Snipe [{result}]"); + //LogMessage?.Invoke($"Attack/Snipe [{result}]"); return result; } } @@ -227,7 +219,7 @@ out var tPos )) { result.TargetPosition = tPos; result.AbilityIndex = TURTLE_INDEX; - LogMessage?.Invoke($"Attack/Turtle [{result}]"); + //LogMessage?.Invoke($"Attack/Turtle [{result}]"); return result; } } @@ -241,14 +233,14 @@ out var attPos )) { result.TargetPosition = attPos; result.AbilityIndex = -1; - LogMessage?.Invoke($"Attack/Normal [{result}]"); + //LogMessage?.Invoke($"Attack/Normal [{result}]"); return result; } // Search with Normal result.TargetPosition = bestHiddenPos; result.AbilityIndex = -1; - LogMessage?.Invoke($"Search/Normal(Attack Failed) [{result}]"); + //LogMessage?.Invoke($"Search/Normal(Attack Failed) [{result}]"); return result; } diff --git a/Assets/Battle Soup/Image/Game/Misc.png b/Assets/Battle Soup/Image/Game/Misc.png index 3e11a49..d9d793d 100644 Binary files a/Assets/Battle Soup/Image/Game/Misc.png and b/Assets/Battle Soup/Image/Game/Misc.png differ diff --git a/Assets/Battle Soup/Image/Game/Misc.png.meta b/Assets/Battle Soup/Image/Game/Misc.png.meta index d216047..723ddb3 100644 --- a/Assets/Battle Soup/Image/Game/Misc.png.meta +++ b/Assets/Battle Soup/Image/Game/Misc.png.meta @@ -77,6 +77,9 @@ TextureImporter: - first: 213: -6064967667912391024 second: Sunk + - first: + 213: 4451419428445612202 + second: Shape externalObjects: {} serializedVersion: 11 mipmaps: @@ -279,7 +282,7 @@ TextureImporter: width: 56 height: 56 alignment: 0 - pivot: {x: 0, y: 0} + pivot: {x: 0.5, y: 0.5} border: {x: 0, y: 0, z: 0, w: 0} outline: [] physicsShape: [] @@ -291,6 +294,27 @@ TextureImporter: indices: edges: [] weights: [] + - serializedVersion: 2 + name: Shape + rect: + serializedVersion: 2 + x: 124 + y: 62 + width: 56 + height: 56 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: aa8e5c2b26e96cd30800000000000000 + internalID: 4451419428445612202 + vertices: [] + indices: + edges: [] + weights: [] outline: [] physicsShape: [] bones: [] diff --git a/Assets/Battle Soup/Image/Game/UI.png b/Assets/Battle Soup/Image/Game/UI.png index d66c4e8..4362b1e 100644 Binary files a/Assets/Battle Soup/Image/Game/UI.png and b/Assets/Battle Soup/Image/Game/UI.png differ diff --git a/Assets/Battle Soup/Prefab/Ability Ship.prefab b/Assets/Battle Soup/Prefab/Ability Ship.prefab index 69a3d15..700d323 100644 --- a/Assets/Battle Soup/Prefab/Ability Ship.prefab +++ b/Assets/Battle Soup/Prefab/Ability Ship.prefab @@ -1,5 +1,85 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &130783213 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 130783214} + - component: {fileID: 130783216} + - component: {fileID: 130783215} + m_Layer: 0 + m_Name: Shape + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &130783214 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 130783213} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 7710310207583506977} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 3, y: -3} + m_SizeDelta: {x: 36, y: 36} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &130783216 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 130783213} + m_CullTransparentMesh: 1 +--- !u!114 &130783215 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 130783213} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f526ab10e718cdb4b8046ed6d4f17dc2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: 8d33f27bc31c03b4abe9f3e8df6f97e6, type: 2} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 0 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 + m_GridCountX: 2 + m_GridCountY: 2 + m_BlockScale: 1 + m_Blocks: + - {fileID: 4451419428445612202, guid: fc635b97dd39b8e478667241261b71e7, type: 3} --- !u!1 &685223871 GameObject: m_ObjectHideFlags: 0 @@ -369,7 +449,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_Sprite: {fileID: -2861580921918571484, guid: 4ee4eafbb0c3b474a91a63e6bbf8d883, type: 3} + m_Sprite: {fileID: -1557013538026691241, guid: 2e90b1f42c055cd43aa9cc0dbf317292, type: 3} m_Type: 0 m_PreserveAspect: 1 m_FillCenter: 1 @@ -419,6 +499,7 @@ RectTransform: - {fileID: 1635236703} - {fileID: 685223872} - {fileID: 1659953712} + - {fileID: 130783214} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -447,6 +528,7 @@ MonoBehaviour: - {fileID: 1560375506} - {fileID: 685223873} - {fileID: 1659953713} + - {fileID: 130783215} --- !u!114 &7710310207583506980 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Battle Soup/Scene/Main.unity b/Assets/Battle Soup/Scene/Main.unity index d4e9ae6..ad6c77d 100644 --- a/Assets/Battle Soup/Scene/Main.unity +++ b/Assets/Battle Soup/Scene/Main.unity @@ -897,6 +897,85 @@ MonoBehaviour: m_EffectColor: {r: 0.21698111, g: 0.21698111, b: 0.21698111, a: 1} m_EffectDistance: {x: 0, y: 2} m_UseGraphicAlpha: 1 +--- !u!1 &109926408 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 109926409} + - component: {fileID: 109926411} + - component: {fileID: 109926410} + m_Layer: 0 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &109926409 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 109926408} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 966915722} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &109926410 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 109926408} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.8207547, g: 0.8207547, b: 0.8207547, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 0 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 20 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Replay +--- !u!222 &109926411 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 109926408} + m_CullTransparentMesh: 1 --- !u!1 &116730527 GameObject: m_ObjectHideFlags: 0 @@ -3679,7 +3758,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &394058516 RectTransform: m_ObjectHideFlags: 0 @@ -3701,10 +3780,10 @@ RectTransform: m_Father: {fileID: 487132412} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 760.5} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 600, y: -192} + m_SizeDelta: {x: 1072, y: 760.5} m_Pivot: {x: 0.5, y: 1} --- !u!1 &395884967 GameObject: @@ -7657,6 +7736,86 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] m_IsOn: 1 +--- !u!1 &717445884 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 717445885} + - component: {fileID: 717445887} + - component: {fileID: 717445886} + m_Layer: 0 + m_Name: Shape + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &717445885 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 717445884} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1054615671} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 3, y: -3} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &717445886 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 717445884} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f526ab10e718cdb4b8046ed6d4f17dc2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 2100000, guid: 8d33f27bc31c03b4abe9f3e8df6f97e6, type: 2} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 0 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 0 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 + m_GridCountX: 3 + m_GridCountY: 3 + m_BlockScale: 1 + m_Blocks: + - {fileID: 4451419428445612202, guid: fc635b97dd39b8e478667241261b71e7, type: 3} +--- !u!222 &717445887 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 717445884} + m_CullTransparentMesh: 1 --- !u!1 &722711845 GameObject: m_ObjectHideFlags: 0 @@ -8469,7 +8628,7 @@ GameObject: - component: {fileID: 831395708} - component: {fileID: 831395707} m_Layer: 0 - m_Name: Play Button + m_Name: Play m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -9279,12 +9438,13 @@ RectTransform: - {fileID: 831395706} - {fileID: 1659069287} - {fileID: 1532620059} + - {fileID: 966915722} m_Father: {fileID: 394058516} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: -8.1797, y: 0} + m_AnchoredPosition: {x: -8.1796875, y: 0} m_SizeDelta: {x: 334.26, y: 84} m_Pivot: {x: 0, y: 0} --- !u!1 &904266904 @@ -9747,7 +9907,7 @@ GameObject: - component: {fileID: 961401175} - component: {fileID: 961401174} m_Layer: 0 - m_Name: Next Button + m_Name: Next m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -10051,6 +10211,165 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 966145548} m_CullTransparentMesh: 1 +--- !u!1 &966915721 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 966915722} + - component: {fileID: 966915726} + - component: {fileID: 966915725} + - component: {fileID: 966915724} + - component: {fileID: 966915723} + m_Layer: 0 + m_Name: Replay + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &966915722 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 966915721} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 109926409} + m_Father: {fileID: 901788106} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 194.98, y: -84} + m_SizeDelta: {x: 119.44, y: 42} + m_Pivot: {x: 0, y: 0} +--- !u!114 &966915723 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 966915721} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ae5b3047fd3682e4791d6547186403b8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Type: 0 +--- !u!114 &966915724 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 966915721} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 0 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 966915725} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 1410421773} + m_TargetAssemblyTypeName: BattleSoup.BattleSoup, BattleSoup + m_MethodName: UI_Replay + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 1 + m_CallState: 2 + - m_Target: {fileID: 919502494} + m_TargetAssemblyTypeName: UnityEngine.AudioSource, UnityEngine + m_MethodName: PlayDelayed + m_Mode: 4 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &966915725 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 966915721} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.26415092, g: 0.26415092, b: 0.26415092, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 0.5 +--- !u!222 &966915726 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 966915721} + m_CullTransparentMesh: 1 --- !u!1 &968145232 GameObject: m_ObjectHideFlags: 0 @@ -10101,6 +10420,7 @@ MonoBehaviour: m_Face: {fileID: 190526904} m_CheatToggle: {fileID: 1399048300} m_DevToggle: {fileID: 1981397196} + m_ReplayButton: {fileID: 966915724} m_AvAControlButton_Play: {fileID: 831395708} m_AvAControlButton_Pause: {fileID: 1659069289} m_AvAControlButton_Next: {fileID: 961401175} @@ -10667,7 +10987,7 @@ MonoBehaviour: m_StartCorner: 0 m_StartAxis: 0 m_CellSize: {x: 70, y: 70} - m_Spacing: {x: 24, y: 42} + m_Spacing: {x: 30, y: 60} m_Constraint: 0 m_ConstraintCount: 2 --- !u!114 &1017016023 @@ -11271,8 +11591,8 @@ MonoBehaviour: m_TargetGraphic: {fileID: 383795425} m_HandleRect: {fileID: 383795424} m_Direction: 2 - m_Value: 1.0000143 - m_Size: 0.9960404 + m_Value: 1 + m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -11320,6 +11640,7 @@ RectTransform: m_Children: - {fileID: 65005069} - {fileID: 1360463184} + - {fileID: 717445885} m_Father: {fileID: 1017016021} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -11440,6 +11761,7 @@ MonoBehaviour: - {fileID: 65005070} - {fileID: 1360463185} - {fileID: 1054615677} + - {fileID: 717445886} --- !u!114 &1054615677 MonoBehaviour: m_ObjectHideFlags: 0 @@ -14165,7 +14487,7 @@ GameObject: - component: {fileID: 1399048300} - component: {fileID: 1399048299} m_Layer: 0 - m_Name: Cheat Button + m_Name: Cheat m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -15252,7 +15574,7 @@ GameObject: - component: {fileID: 1532620060} - component: {fileID: 1532620063} m_Layer: 0 - m_Name: Back Button + m_Name: Back m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -15768,7 +16090,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1552756819 RectTransform: m_ObjectHideFlags: 0 @@ -15788,10 +16110,10 @@ RectTransform: m_Father: {fileID: 487132412} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 600, y: -192} - m_SizeDelta: {x: 1072, y: 574.9} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 574.9} m_Pivot: {x: 0.5, y: 1} --- !u!222 &1552756821 CanvasRenderer: @@ -16490,7 +16812,7 @@ GameObject: - component: {fileID: 1659069289} - component: {fileID: 1659069288} m_Layer: 0 - m_Name: Pause Button + m_Name: Pause m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -19882,7 +20204,7 @@ GameObject: - component: {fileID: 1981397196} - component: {fileID: 1981397195} m_Layer: 0 - m_Name: Dev Button + m_Name: Dev m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -20838,7 +21160,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 692307020} m_HandleRect: {fileID: 692307019} m_Direction: 0 - m_Value: 1 + m_Value: 0 m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: diff --git a/Assets/Battle Soup/Script/Game/BattleSoup.cs b/Assets/Battle Soup/Script/Game/BattleSoup.cs index 197f2bb..4a9057b 100644 --- a/Assets/Battle Soup/Script/Game/BattleSoup.cs +++ b/Assets/Battle Soup/Script/Game/BattleSoup.cs @@ -450,6 +450,12 @@ public void UI_SetSelectingStrategyB (int index) { public void UI_ClearShipSelection () => ClearShipSelection(); + public void UI_Replay () { + CurrentState = GameState.Map; + UI_GotoNextState(); + } + + public void UI_QuitGame () { QuitGameForReal = true; Application.Quit(); diff --git a/Assets/Battle Soup/Script/Game/BattleSoup_LGC.cs b/Assets/Battle Soup/Script/Game/BattleSoup_LGC.cs index 5c43dbf..75d0a36 100644 --- a/Assets/Battle Soup/Script/Game/BattleSoup_LGC.cs +++ b/Assets/Battle Soup/Script/Game/BattleSoup_LGC.cs @@ -42,6 +42,7 @@ private void ReloadShipButtons () { grab.Grab("Label").text = ship.DisplayName; grab.Grab("Thumbnail").sprite = ship.Sprite; grab.Grab().Content = ship.Description; + grab.Grab("Shape").AddBody(ship); } // Final @@ -330,6 +331,8 @@ void DoAbilityUI (RectTransform container, Group group) { // Ability for (int i = 0; i < ships.Length; i++) { var ship = ships[i]; + + var grabber = Instantiate(m_Game.AbilityShip, container); var rt = grabber.transform as RectTransform; @@ -355,6 +358,7 @@ void DoAbilityUI (RectTransform container, Group group) { cooldown.gameObject.SetActive(ship.Ship.Ability.HasActive); cooldown.text = ship.Ship.Ability.Cooldown.ToString(); + grabber.Grab("Shape").AddBody(ship); grabber.Grab("Red Panel").gameObject.SetActive(false); grabber.Grab("Copy").gameObject.SetActive(false); grabber.Grab("Label").text = ship.DisplayName; diff --git a/Assets/Battle Soup/Script/Game/Game.cs b/Assets/Battle Soup/Script/Game/Game.cs index aa19bd6..19f0cad 100644 --- a/Assets/Battle Soup/Script/Game/Game.cs +++ b/Assets/Battle Soup/Script/Game/Game.cs @@ -160,6 +160,7 @@ private enum AttackResult { [SerializeField] Image m_Face = null; [SerializeField] Toggle m_CheatToggle = null; [SerializeField] Toggle m_DevToggle = null; + [SerializeField] Button m_ReplayButton = null; [SerializeField] Button m_AvAControlButton_Play = null; [SerializeField] Button m_AvAControlButton_Pause = null; [SerializeField] Button m_AvAControlButton_Next = null; @@ -381,6 +382,7 @@ public void Init (BattleMode battleMode, SoupStrategy strategyA, SoupStrategy st InfoA.Cooldowns = DataA.Cooldowns; InfoA.Tiles = DataA.Tiles; InfoA.KnownPositions = DataA.KnownPositions; + InfoA.Sonars = DataA.Sonars; InfoB.MapSize = DataB.Map.Size; InfoB.Ships = DataB.Ships; @@ -388,6 +390,7 @@ public void Init (BattleMode battleMode, SoupStrategy strategyA, SoupStrategy st InfoB.Cooldowns = DataB.Cooldowns; InfoB.Tiles = DataB.Tiles; InfoB.KnownPositions = DataB.KnownPositions; + InfoB.Sonars = DataB.Sonars; m_CheatToggle.SetIsOnWithoutNotify(false); m_DevToggle.SetIsOnWithoutNotify(false); @@ -398,6 +401,7 @@ public void Init (BattleMode battleMode, SoupStrategy strategyA, SoupStrategy st m_CheatToggle.gameObject.SetActive(true); m_DevToggle.gameObject.SetActive(true); + m_ReplayButton.gameObject.SetActive(false); AvA_Playing = false; AvA_GotoNext = false; @@ -605,6 +609,7 @@ private void SwitchTurn () { m_AvAControlButton_Play.gameObject.SetActive(false); m_AvAControlButton_Pause.gameObject.SetActive(false); m_AvAControlButton_Next.gameObject.SetActive(false); + m_ReplayButton.gameObject.SetActive(true); return; } diff --git a/Assets/Battle Soup/Script/UI/BlocksRenderer.cs b/Assets/Battle Soup/Script/UI/BlocksRenderer.cs index ea8b759..c1cc5af 100644 --- a/Assets/Battle Soup/Script/UI/BlocksRenderer.cs +++ b/Assets/Battle Soup/Script/UI/BlocksRenderer.cs @@ -172,6 +172,32 @@ void SetColor (Color color) { public void AddBlock (int x, int y, int id, Color color, float scale) => Blocks.Add(new Block(x, y, id, color, scale)); + public void AddBody (ShipData shipData) { + var (bodyMin, bodyMax) = shipData.Ship.GetBounds(false); + var bodySize = bodyMax - bodyMin; + bool flip = false; + if (bodySize.x > bodySize.y) { + (bodyMin, bodyMax) = shipData.Ship.GetBounds(true); + bodySize = bodyMax - bodyMin; + flip = true; + } + GridCountX = bodySize.x + 1; + GridCountY = bodySize.y + 1; + rectTransform.SetSizeWithCurrentAnchors( + RectTransform.Axis.Horizontal, + GridCountX * 12 + ); + rectTransform.SetSizeWithCurrentAnchors( + RectTransform.Axis.Vertical, + GridCountY * 12 + ); + ClearBlock(); + foreach (var v in shipData.Ship.Body) { + AddBlock(flip ? v.y : v.x, flip ? v.x : v.y, 0); + } + } + + public void ClearBlock () { if (Blocks.Count > 0) { Blocks.Clear(); @@ -187,27 +213,6 @@ public void ClearBlock () { - #region --- LGC --- - - - - - #endregion - - - - - #region --- UTL --- - - - - - #endregion - - - - - } } diff --git a/Assets/Battle Soup/Script/UI/ShipPositionUI.cs b/Assets/Battle Soup/Script/UI/ShipPositionUI.cs index 2ca449e..4fa8f23 100644 --- a/Assets/Battle Soup/Script/UI/ShipPositionUI.cs +++ b/Assets/Battle Soup/Script/UI/ShipPositionUI.cs @@ -245,7 +245,7 @@ private void ClampAllShipsInSoup () { for (int i = 0; i < _Ships.Length; i++) { var ship = _Ships[i]; var sPos = _Positions[i]; - var (min, max) = ship.Ship.GetBounds(sPos); + var (min, max) = ship.Ship.GetBounds(sPos.Flip); sPos.Pivot.x = Mathf.Clamp(sPos.Pivot.x, -min.x, mapSize - max.x - 1); sPos.Pivot.y = Mathf.Clamp(sPos.Pivot.y, -min.y, mapSize - max.y - 1); _Positions[i] = sPos;