private static SVector3 GetEnemySerializablePosition(GameObject enemy) { Vector3 enemyPos = enemy.transform.position; SVector3 enemySerializablePos = new SVector3(enemyPos); return(enemySerializablePos); }
private static SVector3 GetEnemySerializableRotation(GameObject enemy) { Vector3 rot = enemy.transform.rotation.eulerAngles; SVector3 serializableRot = new SVector3(rot); return(serializableRot); }
private SVector3 GetPlayerSerializablePosition() { Vector3 position = playerHealth.transform.position; SVector3 serializablePos = new SVector3(position); return(serializablePos); }
private GameData CreateGameData() { // get camera position Vector3 cameraPos = Camera.main.transform.position; SVector3 serializableCameraPos = new SVector3(cameraPos); GameData data = new GameData() { CameraPosition = serializableCameraPos }; return(data); }
private PlayerData CreatePlayerData() { int health = playerHealth.currentHealth; int score = ScoreManager.score; SVector3 position = GetPlayerSerializablePosition(); PlayerData playerData = new PlayerData { Health = health, Score = score, Position = position }; return(playerData); }
private EnemyData CreateEnemyData(GameObject enemy) { string prefabName = ConvertGameObjectNameToPrefabName(enemy.name); int enemyHealth = GetEnemyHealth(enemy); SVector3 enemySerializablePos = GetEnemySerializablePosition(enemy); SVector3 serializableRot = GetEnemySerializableRotation(enemy); EnemyData enemyData = new EnemyData() { PrefabName = prefabName, Health = enemyHealth, Position = enemySerializablePos, Rotation = serializableRot }; return(enemyData); }