Game Development Reference
In-Depth Information
31 public class DataEnemy
32 {
33 //Enemy Transform Data
34 public DataTransform PosRotScale;
35 //Enemy ID
36 public int EnemyID;
37 //Health
38 public int Health;
39 }
40 //-----------------------------------------------
41 //Data for player
42 public class DataPlayer
43 {
44 //Transform Data
45 public DataTransform PosRotScale;
46
47 //Collected cash
48 public float CollectedCash;
49
50 //Has Collected Gun 01?
51 public bool CollectedGun;
52
53 //Health
54 public int Health;
55 }
56 //-----------------------------------------------
57
58 //Instance variables
59 public List<DataEnemy> Enemies = new List<DataEnemy>();
60
61 public DataPlayer Player = new DataPlayer();
62 }
63
64 //Game data to save/load
65 public GameStateData GameState = new GameStateData();
66
67 //-----------------------------------------------
68 }
69 //-----------------------------------------------
Lines 01-69. Here, in total, a range of classes are defined for holding save-game
data. This includes classes DataTransform , DataEnemy , and DataPlayer .
Lines 17-27. The DataTransform class defines a complete transform for a game
object using serializable data types, such as float, to hold data that would
normally feature only in a game object's transform component, which is not
serializable.
Search WWH ::




Custom Search