Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Supergame Box
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GameDevWeek
S
Sommersemester 2019
Unity
Supergame Box
Commits
19d1b513
Commit
19d1b513
authored
Sep 21, 2019
by
Bene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed Spawnerscripting to prevent nullreferences on objects after quitting the game.
parent
306d60df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
12 deletions
+11
-12
Assets/_Game/Scribble Fall/Scripts/PlattformGenerating.cs
Assets/_Game/Scribble Fall/Scripts/PlattformGenerating.cs
+5
-9
Assets/_Game/Scribble Fall/Scripts/SpawnerScript.cs
Assets/_Game/Scribble Fall/Scripts/SpawnerScript.cs
+6
-3
No files found.
Assets/_Game/Scribble Fall/Scripts/PlattformGenerating.cs
View file @
19d1b513
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine
;
public
class
PlattformGenerating
:
MonoBehaviour
{
public
GameObject
spawner
;
private
SpawnerScript
spawner
;
private
void
OnBecameInvisible
()
{
spawner
.
GetComponent
<
SpawnerScript
>().
generateplattform
();
//Destroy(gameObject);
if
(
spawner
!=
null
)
spawner
.
generateplattform
();
}
private
void
Start
()
{
spawner
=
GameObject
.
FindWithTag
(
"Scribblespawner"
);
spawner
=
FindObjectOfType
<
SpawnerScript
>(
);
}
}
Assets/_Game/Scribble Fall/Scripts/SpawnerScript.cs
View file @
19d1b513
using
System.Collections
;
using
System
;
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
Random
=
UnityEngine
.
Random
;
public
class
SpawnerScript
:
MonoBehaviour
{
...
...
@@ -19,7 +21,10 @@ public class SpawnerScript : MonoBehaviour
public
void
generateplattform
()
{
amountofplattforms
--;
}
private
void
Update
()
{
for
(
int
i
=
0
;
amountofplattforms
<
maximumamountofplattforms
;
i
++)
{
int
rand
=
Random
.
Range
(
1
,
13
);
...
...
@@ -71,8 +76,6 @@ public class SpawnerScript : MonoBehaviour
}
}
public
void
generator
(
GameObject
scribbleobject
,
int
rand
)
{
int
plattformoffset
=
Random
.
Range
(-
6
,
6
);
...
...
Write
Preview
Markdown
is supported
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