Hi! I have important POC task, but still can't accomplish it... Task is: Get one of Player's groups (maybe Active group for now), make it's copy with full ability/equipment info, serialize it to string, and then, deserialize it and start battle against this group :) I'm sure, someone tryed to accomplish this task, nad could help me... Thank you in advance!
You can create a copy of a group like this (and make the group part of faction with ID/index factionID:
DataObject data = group.SaveGame(); Group newGroup = new Group(data); newGroup.FactionID = factionID; newGroup.LoadMembers(data, false);
Now, if you have a game object with a Battle component attached, you can use this function of the Battle component to start the battle against that group:
battleComponent.StartGroup(newGroup, null);
Instead of null you can also use a class as parameter that implements the IEventStarter interface to get notified once the battle ended.
Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found. If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
DataObject data = group.SaveGame();
Group newGroup = new Group(data);
newGroup.FactionID = factionID;
newGroup.LoadMembers(data, false);
Now, if you have a game object with a Battle component attached, you can use this function of the Battle component to start the battle against that group:
battleComponent.StartGroup(newGroup, null);
Instead of null you can also use a class as parameter that implements the IEventStarter interface to get notified once the battle ended.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!