Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Wintersemester 2018-2019
Unity
Suck It
Commits
de626af5
Commit
de626af5
authored
Mar 26, 2019
by
Michael But
Browse files
Save und Load u. neue Scene aus der Main
parent
1c12a815
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Assets/_Game/
Scripts/Interaction
.meta
→
Assets/_Game/
Data/Player Data
.meta
View file @
de626af5
fileFormatVersion: 2
fileFormatVersion: 2
guid:
5782222d4c9b9424ea96676650e643a8
guid:
29c3b47bb1f689d40953870d9f90e2c4
folderAsset: yes
folderAsset: yes
DefaultImporter:
DefaultImporter:
externalObjects: {}
externalObjects: {}
...
...
Assets/_Game/Scenes/MainLevel Michi.unity
0 → 100644
View file @
de626af5
This diff is collapsed.
Click to expand it.
Assets/_Game/Scenes/MainLevel Michi.unity.meta
0 → 100644
View file @
de626af5
fileFormatVersion: 2
guid: ab1e512d906a26744bbbd85d3ea1d157
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/_Game/Scenes/Michi_Test_Scene.unity
View file @
de626af5
...
@@ -122,7 +122,7 @@ PrefabInstance:
...
@@ -122,7 +122,7 @@ PrefabInstance:
-
target
:
{
fileID
:
395035932932740994
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
-
target
:
{
fileID
:
395035932932740994
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
type
:
3
}
type
:
3
}
propertyPath
:
m_Name
propertyPath
:
m_Name
value
:
SavePoint
(2)
value
:
SavePoint
2
objectReference
:
{
fileID
:
0
}
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
395035932932740992
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
-
target
:
{
fileID
:
395035932932740992
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
type
:
3
}
type
:
3
}
...
@@ -137,7 +137,7 @@ PrefabInstance:
...
@@ -137,7 +137,7 @@ PrefabInstance:
-
target
:
{
fileID
:
395035932932740992
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
-
target
:
{
fileID
:
395035932932740992
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
type
:
3
}
type
:
3
}
propertyPath
:
m_LocalPosition.z
propertyPath
:
m_LocalPosition.z
value
:
-22.677734
value
:
0
objectReference
:
{
fileID
:
0
}
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
395035932932740992
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
-
target
:
{
fileID
:
395035932932740992
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
type
:
3
}
type
:
3
}
...
@@ -332,7 +332,7 @@ PrefabInstance:
...
@@ -332,7 +332,7 @@ PrefabInstance:
-
target
:
{
fileID
:
395035932932740994
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
-
target
:
{
fileID
:
395035932932740994
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
type
:
3
}
type
:
3
}
propertyPath
:
m_Name
propertyPath
:
m_Name
value
:
SavePoint
(1)
value
:
SavePoint
1
objectReference
:
{
fileID
:
0
}
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
395035932932740992
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
-
target
:
{
fileID
:
395035932932740992
,
guid
:
3ff4cf871f5edaa40b0530c80a9ff9df
,
type
:
3
}
type
:
3
}
...
...
Assets/_Game/Scripts/SaveAndLoad/SavePointData.cs
View file @
de626af5
...
@@ -13,4 +13,11 @@ public class SavePointData
...
@@ -13,4 +13,11 @@ public class SavePointData
position
[
0
]
=
save
.
transform
.
position
.
x
;
position
[
0
]
=
save
.
transform
.
position
.
x
;
position
[
1
]
=
save
.
transform
.
position
.
y
;
position
[
1
]
=
save
.
transform
.
position
.
y
;
}
}
public
SavePointData
(
Vector2
save
)
{
position
=
new
float
[
2
];
position
[
0
]
=
save
.
x
;
position
[
1
]
=
save
.
y
;
}
}
}
Assets/_Game/Scripts/SaveAndLoad/SaveSystem.cs
View file @
de626af5
using
System
;
using
System.IO
;
using
System.IO
;
using
System.Runtime.Serialization.Formatters.Binary
;
using
System.Runtime.Serialization.Formatters.Binary
;
using
UnityEngine
;
using
UnityEngine
;
using
UnityEngine.SceneManagement
;
public
class
SaveSystem
public
class
SaveSystem
...
@@ -14,7 +16,6 @@ public class SaveSystem
...
@@ -14,7 +16,6 @@ public class SaveSystem
SavePointData
data
=
new
SavePointData
(
save
);
SavePointData
data
=
new
SavePointData
(
save
);
formatter
.
Serialize
(
stream
,
data
);
formatter
.
Serialize
(
stream
,
data
);
stream
.
Close
();
stream
.
Close
();
}
}
...
@@ -25,6 +26,7 @@ public class SaveSystem
...
@@ -25,6 +26,7 @@ public class SaveSystem
{
{
BinaryFormatter
formatter
=
new
BinaryFormatter
();
BinaryFormatter
formatter
=
new
BinaryFormatter
();
FileStream
stream
=
new
FileStream
(
path
,
FileMode
.
Open
);
FileStream
stream
=
new
FileStream
(
path
,
FileMode
.
Open
);
SavePointData
data
=
formatter
.
Deserialize
(
stream
)
as
SavePointData
;
SavePointData
data
=
formatter
.
Deserialize
(
stream
)
as
SavePointData
;
stream
.
Close
();
stream
.
Close
();
...
@@ -38,13 +40,14 @@ public class SaveSystem
...
@@ -38,13 +40,14 @@ public class SaveSystem
}
}
}
}
public
static
void
LoadScene
()
public
static
void
NewGame
(
Vector2
vec
)
{
}
public
static
void
NewGame
()
{
{
BinaryFormatter
formatter
=
new
BinaryFormatter
();
string
path
=
Application
.
persistentDataPath
+
"/SP.txt"
;
FileStream
stream
=
new
FileStream
(
path
,
FileMode
.
Create
);
SavePointData
data
=
new
SavePointData
(
vec
);
formatter
.
Serialize
(
stream
,
data
);
stream
.
Close
();
}
}
}
}
ProjectSettings/EditorBuildSettings.asset
View file @
de626af5
...
@@ -4,5 +4,11 @@
...
@@ -4,5 +4,11 @@
EditorBuildSettings
:
EditorBuildSettings
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
serializedVersion
:
2
serializedVersion
:
2
m_Scenes
:
[]
m_Scenes
:
-
enabled
:
1
path
:
Assets/_Game/Scenes/DemoScenePlayerControls.unity
guid
:
f74dd84d63bfc43d5be164a706dd669d
-
enabled
:
1
path
:
Assets/_Game/Scenes/Michi_Test_Scene.unity
guid
:
c748fb3183302944b8f320153a72a1f5
m_configObjects
:
{}
m_configObjects
:
{}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment