Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions Dots-RTS-Development/Assets/BulkRename.meta

This file was deleted.

48 changes: 24 additions & 24 deletions Dots-RTS-Development/Assets/Scenes/Level_Player.unity
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
23 changes: 15 additions & 8 deletions Dots-RTS-Development/Assets/Scripts/AI/Enemy_AI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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) {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
55 changes: 55 additions & 0 deletions Dots-RTS-Development/Assets/Scripts/LevelEditor/TeamSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ public class TeamSetup : MonoBehaviour {
[HideInInspector]
public float roundTableR;

#region Dictionary debug tool
//Dictionary<Cell.enmTeam, AIHolder>.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<Canvas>().scaleFactor);
roundTableR = ((roundTable.rect.width * 0.5f)) - teamGOPrefab.GetComponent<RectTransform>().sizeDelta.x;
Expand Down Expand Up @@ -323,6 +338,46 @@ public int MySpawnsIndexFromAngle(float RawAngle) {
}
return output;
}

public Dictionary<Cell.enmTeam,AIHolder> dictWithAllInfo() {
Dictionary<Cell.enmTeam, AIHolder> newDict = new Dictionary<Cell.enmTeam, AIHolder>();
Dictionary<Cell.enmTeam, AIHolder>.KeyCollection TeamKeys = clanDict.Keys;
List<Cell.enmTeam> noClaners = new List<Cell.enmTeam>(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<Cell.enmTeam>(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<Cell.enmTeam>(core.teamList);
newAiHolder.targets.Remove(team);
newDict.Add(team, newAiHolder);
}


return newDict;


}
}

[System.Serializable]
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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