diff --git a/Dots-RTS-Development/Assets/BulkRename.meta b/Dots-RTS-Development/Assets/BulkRename.meta deleted file mode 100644 index ccdb37b..0000000 --- a/Dots-RTS-Development/Assets/BulkRename.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 15eedef553a4a5c4c9ac76d8104e5807 -folderAsset: yes -timeCreated: 1506764672 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Dots-RTS-Development/Assets/Scenes/Level_Player.unity b/Dots-RTS-Development/Assets/Scenes/Level_Player.unity index ef8e704..d20f21d 100644 --- a/Dots-RTS-Development/Assets/Scenes/Level_Player.unity +++ b/Dots-RTS-Development/Assets/Scenes/Level_Player.unity @@ -292,7 +292,7 @@ Prefab: - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} propertyPath: m_AnchoredPosition.x - value: 599.6117 + value: 599.72473 objectReference: {fileID: 0} - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} @@ -416,7 +416,7 @@ Prefab: - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} propertyPath: m_AnchoredPosition.x - value: 467.20877 + value: 467.29355 objectReference: {fileID: 0} - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} @@ -1346,7 +1346,7 @@ Prefab: - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} propertyPath: m_AnchoredPosition.x - value: 334.80585 + value: 334.86237 objectReference: {fileID: 0} - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} @@ -1648,7 +1648,7 @@ MonoBehaviour: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 631089167} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 1453722849, guid: 89f0137620f6af44b9ba852b4190e64e, type: 3} m_Name: @@ -1737,11 +1737,11 @@ MonoBehaviour: lineCount: 1 pageCount: 1 materialCount: 1 - m_havePropertiesChanged: 0 + m_havePropertiesChanged: 1 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} - m_isInputParsingRequired: 0 + m_isInputParsingRequired: 1 m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: @@ -1965,7 +1965,7 @@ Prefab: - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} propertyPath: m_AnchoredPosition.x - value: 996.82056 + value: 997.0182 objectReference: {fileID: 0} - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} @@ -2683,7 +2683,7 @@ Prefab: - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} propertyPath: m_AnchoredPosition.x - value: 1129.2235 + value: 1129.4493 objectReference: {fileID: 0} - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} @@ -3836,7 +3836,7 @@ MonoBehaviour: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1263508644} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 1453722849, guid: 89f0137620f6af44b9ba852b4190e64e, type: 3} m_Name: @@ -3925,11 +3925,11 @@ MonoBehaviour: lineCount: 1 pageCount: 1 materialCount: 1 - m_havePropertiesChanged: 0 + m_havePropertiesChanged: 1 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} - m_isInputParsingRequired: 0 + m_isInputParsingRequired: 1 m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: @@ -4196,7 +4196,7 @@ Prefab: - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} propertyPath: m_AnchoredPosition.x - value: 202.40292 + value: 202.43118 objectReference: {fileID: 0} - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} @@ -4723,7 +4723,7 @@ Prefab: - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} propertyPath: m_AnchoredPosition.x - value: 864.4176 + value: 864.58704 objectReference: {fileID: 0} - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} @@ -4887,7 +4887,7 @@ Prefab: - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} propertyPath: m_AnchoredPosition.x - value: 1261.6265 + value: 1261.8805 objectReference: {fileID: 0} - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} @@ -5017,7 +5017,7 @@ MonoBehaviour: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1465621277} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 1453722849, guid: 89f0137620f6af44b9ba852b4190e64e, type: 3} m_Name: @@ -5106,11 +5106,11 @@ MonoBehaviour: lineCount: 1 pageCount: 1 materialCount: 1 - m_havePropertiesChanged: 0 + m_havePropertiesChanged: 1 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} - m_isInputParsingRequired: 0 + m_isInputParsingRequired: 1 m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: @@ -6452,7 +6452,7 @@ Prefab: - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} propertyPath: m_AnchoredPosition.x - value: 732.01465 + value: 732.1559 objectReference: {fileID: 0} - target: {fileID: 224330000714602946, guid: d1ba9546a2394a84a8392d5719b29294, type: 2} @@ -7158,7 +7158,7 @@ MonoBehaviour: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1968041218} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 1453722849, guid: 89f0137620f6af44b9ba852b4190e64e, type: 3} m_Name: @@ -7247,11 +7247,11 @@ MonoBehaviour: lineCount: 1 pageCount: 1 materialCount: 1 - m_havePropertiesChanged: 0 + m_havePropertiesChanged: 1 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} - m_isInputParsingRequired: 0 + m_isInputParsingRequired: 1 m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: @@ -7312,7 +7312,7 @@ MonoBehaviour: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 2029816252} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 1453722849, guid: 89f0137620f6af44b9ba852b4190e64e, type: 3} m_Name: @@ -7401,11 +7401,11 @@ MonoBehaviour: lineCount: 1 pageCount: 1 materialCount: 1 - m_havePropertiesChanged: 0 + m_havePropertiesChanged: 1 m_isUsingLegacyAnimationComponent: 0 m_isVolumetricText: 0 m_spriteAnimator: {fileID: 0} - m_isInputParsingRequired: 0 + m_isInputParsingRequired: 1 m_inputSource: 0 m_hasFontAssetChanged: 0 m_subTextObjects: diff --git a/Dots-RTS-Development/Assets/Scripts/AI/Enemy_AI.cs b/Dots-RTS-Development/Assets/Scripts/AI/Enemy_AI.cs index 9e0cd4a..37b55f4 100644 --- a/Dots-RTS-Development/Assets/Scripts/AI/Enemy_AI.cs +++ b/Dots-RTS-Development/Assets/Scripts/AI/Enemy_AI.cs @@ -64,6 +64,13 @@ protected virtual void Start() { ConsiderAllies(); print("AI " + getCurrentAiTeam + " Initialized!"); + + foreach (Enemy_AI friend in alliesOfThisAI) { + print("ally of " + aiTeam + " is " + friend.aiTeam); + } + foreach (Enemy_AI target in targetsOfThisAI) { + print("target of " + aiTeam + " is " + target.aiTeam); + } } protected virtual void OnDestroy() { @@ -73,14 +80,14 @@ protected virtual void OnDestroy() { private void CellBehaviour_TeamChanged(CellBehaviour sender, Cell.enmTeam previous, Cell.enmTeam current) { if (isActive) { - if(previous == Cell.enmTeam.NEUTRAL) { + if (previous == Cell.enmTeam.NEUTRAL) { for (int i = 0; i < Initialize_AI.AIs.Length; i++) { - if(Initialize_AI.AIs[i] != null) { + if (Initialize_AI.AIs[i] != null) { Initialize_AI.AIs[i]._neutrals.Remove(sender); } } Enemy_AI reference = (Enemy_AI)current; - if(reference == this) { + if (reference == this) { reference._aiCells.Add(sender); foreach (Enemy_AI ally in reference.getAllies) { @@ -92,21 +99,21 @@ private void CellBehaviour_TeamChanged(CellBehaviour sender, Cell.enmTeam previo target.ProcessData(currData, true); } } - else if(reference == null) { + else if (reference == null) { //Cell was taken by a player --> we have no reference so we'll add sender as a target to every AI because player+enemy teams are not possible atm. - foreach(Enemy_AI ai in Initialize_AI.AIs) { - if(ai == this) { + foreach (Enemy_AI ai in Initialize_AI.AIs) { + if (ai == this) { ai._targets.Add(sender); } } } } - if(previous == Cell.enmTeam.ALLIED) { + if (previous == Cell.enmTeam.ALLIED) { Enemy_AI curr = (Enemy_AI)current; curr._aiCells.Add(sender); foreach (Enemy_AI ally in curr.getAllies) { DataHolder currData = DataHolder.TransformForAlly(new DataHolder(curr, sender), ally); - ally.ProcessData(currData,true); + ally.ProcessData(currData, true); } foreach (Enemy_AI enemy in curr.getTargets) { DataHolder currData = DataHolder.TransformForTarget(new DataHolder(curr, sender), enemy); diff --git a/Dots-RTS-Development/Assets/Scripts/LevelEditor/LevelEditorCore.cs b/Dots-RTS-Development/Assets/Scripts/LevelEditor/LevelEditorCore.cs index a5c5e5c..ef32488 100644 --- a/Dots-RTS-Development/Assets/Scripts/LevelEditor/LevelEditorCore.cs +++ b/Dots-RTS-Development/Assets/Scripts/LevelEditor/LevelEditorCore.cs @@ -160,7 +160,7 @@ private void Start() { string path = PlayerPrefs.GetString("LoadLevelFilePath"); if (!string.IsNullOrEmpty(path)) { saveAndLoad.Load(PlayerPrefs.GetString("LoadLevelFilePath")); - } + } //Set defalut mode to placeCells editorMode = Mode.PlaceCells; } @@ -178,13 +178,15 @@ public void AddCell(EditCell c, bool loadedFromFile = false) { c.ToggleCellOutline(true); } if (c.cellTeam != Cell.enmTeam.ALLIED && c.cellTeam != Cell.enmTeam.NEUTRAL) { - if (!loadedFromFile) { - if (!teamList.Contains(c.cellTeam)) { - teamList.Add(c.cellTeam); + + if (!teamList.Contains(c.cellTeam)) { + teamList.Add(c.cellTeam); + if (!loadedFromFile) { aiDifficultyDict.Add(c.cellTeam, defaultDificulty); AllAiDifficultyWriter.RedoText(aiDifficultyDict); } } + } if (loadedFromFile) { for (int i = 0; i < c.upgrade_manager.upgrade_Slots.Length; i++) { diff --git a/Dots-RTS-Development/Assets/Scripts/LevelEditor/SaveAndLoadEditor.cs b/Dots-RTS-Development/Assets/Scripts/LevelEditor/SaveAndLoadEditor.cs index 895e6f3..5908409 100644 --- a/Dots-RTS-Development/Assets/Scripts/LevelEditor/SaveAndLoadEditor.cs +++ b/Dots-RTS-Development/Assets/Scripts/LevelEditor/SaveAndLoadEditor.cs @@ -96,11 +96,17 @@ public string Save(bool temp = false) { } save.savedAtAspect = Camera.main.aspect; + + save.difficulty = core.aiDifficultyDict; + + save.gameSize = core.gameSize; save.levelInfo = new LevelInfo(core.levelName, core.authorName, DateTime.Now); + - save.clans = teams.clanDict; + save.clans = teams.dictWithAllInfo(); + ErrorMessages.text += " displayName:(" + save.levelInfo.levelName + ")"; formatter.Serialize(file, save); file.Close(); diff --git a/Dots-RTS-Development/Assets/Scripts/LevelEditor/TeamSetup.cs b/Dots-RTS-Development/Assets/Scripts/LevelEditor/TeamSetup.cs index 7b97377..682e3bb 100644 --- a/Dots-RTS-Development/Assets/Scripts/LevelEditor/TeamSetup.cs +++ b/Dots-RTS-Development/Assets/Scripts/LevelEditor/TeamSetup.cs @@ -19,6 +19,21 @@ public class TeamSetup : MonoBehaviour { [HideInInspector] public float roundTableR; + #region Dictionary debug tool + //Dictionary.KeyCollection keys = newDict.Keys; + // foreach (Cell.enmTeam team in keys) { + // string s = ""; + //AIHolder hold = new AIHolder(); + //newDict.TryGetValue(team, out hold); + // foreach(Cell.enmTeam t in hold.targets) { + // s += (" " + t + " "); + + // } + // print(team + " has targets:" + s ); + + // } + #endregion + void OnEnable() { print(GameObject.Find("Canvas").GetComponent().scaleFactor); roundTableR = ((roundTable.rect.width * 0.5f)) - teamGOPrefab.GetComponent().sizeDelta.x; @@ -323,6 +338,46 @@ public int MySpawnsIndexFromAngle(float RawAngle) { } return output; } + + public Dictionary dictWithAllInfo() { + Dictionary newDict = new Dictionary(); + Dictionary.KeyCollection TeamKeys = clanDict.Keys; + List noClaners = new List(core.teamList); + foreach (Cell.enmTeam team in TeamKeys) { + noClaners.Remove(team); + AIHolder holder = new AIHolder(); + if(clanDict.TryGetValue(team, out holder) == false) { + Debug.LogError("This can't happen"); + clanDict.Add(team, holder); + } + holder.targets = new List(core.teamList); + //print(" targets start " + holder.targets.Count); + //print(" allies " + holder.allies.Count); + holder.targets.Remove(team); + foreach (Cell.enmTeam ally in holder.allies) { + holder.targets.Remove(ally); + //print("this runs this time"); + } + //print("targets ends at " + holder.targets.Count); + if (holder.targets.Count + holder.allies.Count != core.teamList.Count - 1) { + Debug.LogError("Targets&Allies don't add up to AllTeams"); + } + + newDict.Add(team, holder); + + } + foreach (Cell.enmTeam team in noClaners) { + AIHolder newAiHolder = new AIHolder(); + newAiHolder.targets = new List(core.teamList); + newAiHolder.targets.Remove(team); + newDict.Add(team, newAiHolder); + } + + + return newDict; + + + } } [System.Serializable] diff --git a/README.md b/README.md index c5fe123..102493e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ # Dots-RTS-Development -Initial Commit + +This repo is focuesd on recreation of a game called PahgeWars. + +Currently WIP, implemented fatures are: Level Player + Level Editor + Upgrade System + Profiles + Level Sharing over the internet +Game logic was rewritten from scratch. +Tetures... of we can call it that are also my own. +Only the name is original, but I will come up with something else in the future