-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started implementing the interfaces for accessing the data structure
This will allow the fluid sim to properly work with the data structure and allow separate systems to interact with each other via the data structure
- Loading branch information
Showing
6 changed files
with
569 additions
and
502 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace SimDataStructure | ||
{ | ||
/** | ||
<summary> | ||
For a class to be able to read the data, it needs to implement the IReadDataStructure interface. | ||
The implementing class can read data from only ONE grid level | ||
</summary> | ||
*/ | ||
public interface IReadDataStructure | ||
{ | ||
readonly int readLevel; // The grid level to receive data from | ||
readonly List<string> readDataNames; // The names of the data to receive | ||
|
||
/** | ||
<summary> | ||
Called by the data structure at the beginning of every tick to send the requested list of data to the implementing class. | ||
It is recommended for the implementing class to cache the received list of data for use only during the tick, to avoid memory bloat, but the received data list can also be cached for data deltas, etc. | ||
</summary> | ||
*/ | ||
void recieveData(List<AbstractGridData> sentData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
namespace SimDataStructure | ||
{ | ||
/** | ||
<summary> | ||
For a class to be able to write data to the data structure, it needs to implement the IWriteDataStructure interface. | ||
The implementing class can write data to ONLY one grid level | ||
</summary> | ||
*/ | ||
public interface IWriteDataStructure | ||
{ | ||
readonly int writeLevel; // The grid level to write data to | ||
readonly List<string> writeDataNames; // The names of the data you are writing to the data structure | ||
|
||
/** | ||
<summary> | ||
Called by the data structure at the end of every tick to write data to the data structure. | ||
This function should return a list of the data that the implementing class wants to write to the data structure. | ||
The returned list of data MUST be the same length as the writeDataNames list and the index of each item in the returned list MUST correspond to its respective index in the writeDataNames list. | ||
</summary> | ||
*/ | ||
List<AbstractGridData> writeData(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using UnityEngine; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace Managers { | ||
public class SystemsManager : MonoBehaviour { | ||
public static SystemsManager Instance { get; private set; } | ||
|
||
public List<ITickableSystem> tickableSystems = new List<ITickableSystem>(); | ||
|
||
public void Awake() { | ||
Instance = this; | ||
} | ||
|
||
public void FixedUpdate() { | ||
// Tick all manager systems | ||
for (int i = 0; i < tickableSystems.Count; i++) { | ||
tickableSystems[i].BeginTick(); | ||
} | ||
|
||
for (int i = 0; i < tickableSystems.Count; i++) { | ||
tickableSystems[i].Tick(); | ||
} | ||
|
||
for (int i = 0; i < tickableSystems.Count; i++) { | ||
tickableSystems[i].EndTick(); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.