Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
igem-quantifly
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
igem-quantifly
Commits
80efc979
Commit
80efc979
authored
Oct 25, 2016
by
Naliwe GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gameplay fixes
parent
74e79f6e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
8 deletions
+16
-8
GameController.cs
Assets/Scripts/GameController.cs
+2
-1
Player.cs
Assets/Scripts/Player.cs
+7
-2
Spawner.cs
Assets/Scripts/Spawner.cs
+7
-5
No files found.
Assets/Scripts/GameController.cs
View file @
80efc979
...
@@ -33,7 +33,8 @@ namespace Assets.Scripts
...
@@ -33,7 +33,8 @@ namespace Assets.Scripts
var
leftBorder
=
Camera
.
main
.
ScreenToWorldPoint
(
new
Vector3
(
0
,
0
,
0
)).
x
;
var
leftBorder
=
Camera
.
main
.
ScreenToWorldPoint
(
new
Vector3
(
0
,
0
,
0
)).
x
;
if
(!(
rightBorder
>
(
size
.
x
*
mult
)
-
5
))
return
;
if
(!(
rightBorder
>
(
size
.
x
*
mult
)
-
5
))
return
;
BG
=
(
GameObject
)
Instantiate
(
BG
,
new
Vector3
(
size
.
x
+
tra
.
position
.
x
-
.
5f
,
tra
.
position
.
y
,
0
),
Quaternion
.
identity
);
BG
=
(
GameObject
)
Instantiate
(
BG
,
new
Vector3
(
size
.
x
+
tra
.
position
.
x
-
.
5f
,
tra
.
position
.
y
,
2
),
Quaternion
.
identity
);
tra
=
BG
.
GetComponent
<
Transform
>();
tra
=
BG
.
GetComponent
<
Transform
>();
mult
++;
mult
++;
}
}
...
...
Assets/Scripts/Player.cs
View file @
80efc979
...
@@ -25,17 +25,22 @@ namespace Assets.Scripts
...
@@ -25,17 +25,22 @@ namespace Assets.Scripts
var
newPos
=
Camera
.
main
.
ScreenToWorldPoint
(
Input
.
mousePosition
);
var
newPos
=
Camera
.
main
.
ScreenToWorldPoint
(
Input
.
mousePosition
);
newPos
.
z
=
-
1
;
newPos
.
z
=
-
1
;
_pos
.
position
=
Vector3
.
Lerp
(
_pos
.
position
,
newPos
,
10
*
Time
.
deltaTime
);
_pos
.
position
=
Vector3
.
Lerp
(
_pos
.
position
,
newPos
,
10
*
Time
.
deltaTime
);
if
(
IsBlinking
)
if
(
IsBlinking
)
Blink
();
Blink
();
if
(
Battery
<
12
)
if
(
Battery
<
12
)
{
{
PlayerPrefs
.
SetInt
(
"highscore"
,
Score
);
if
(
PlayerPrefs
.
GetInt
(
"highscore"
)
<
Score
)
PlayerPrefs
.
SetInt
(
"highscore"
,
Score
);
SceneManager
.
LoadScene
(
"GameOver"
);
SceneManager
.
LoadScene
(
"GameOver"
);
}
}
if
(
Progression
==
25
)
if
(
Progression
==
25
)
{
if
(
PlayerPrefs
.
GetInt
(
"highscore"
)
<
Score
)
PlayerPrefs
.
SetInt
(
"highscore"
,
Score
);
SceneManager
.
LoadScene
(
"Win"
);
SceneManager
.
LoadScene
(
"Win"
);
}
}
}
public
void
Blink
()
public
void
Blink
()
...
...
Assets/Scripts/Spawner.cs
View file @
80efc979
using
UnityEngine
;
using
System
;
using
UnityEngine
;
using
System.Collections
;
using
System.Collections
;
public
class
Spawner
:
MonoBehaviour
public
class
Spawner
:
MonoBehaviour
...
@@ -22,7 +23,7 @@ public class Spawner : MonoBehaviour
...
@@ -22,7 +23,7 @@ public class Spawner : MonoBehaviour
_timer
+=
Time
.
deltaTime
;
_timer
+=
Time
.
deltaTime
;
_rightBorder
=
Camera
.
main
.
ScreenToWorldPoint
(
new
Vector3
(
Screen
.
width
,
Screen
.
height
,
0
)).
x
+
2
;
_rightBorder
=
Camera
.
main
.
ScreenToWorldPoint
(
new
Vector3
(
Screen
.
width
,
Screen
.
height
,
0
)).
x
+
2
;
if
(
_timer
>=
2f
)
if
(
_timer
>=
Math
.
Max
((
2
/
(
Time
.
time
/
10
)),
.
5f
)
)
{
{
Spawn
();
Spawn
();
_timer
=
0f
;
_timer
=
0f
;
...
@@ -35,9 +36,10 @@ public class Spawner : MonoBehaviour
...
@@ -35,9 +36,10 @@ public class Spawner : MonoBehaviour
if
(
r
<
20
)
if
(
r
<
20
)
Instantiate
(
StaticEnemy
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
1
,
9
),
0
),
Quaternion
.
identity
);
Instantiate
(
StaticEnemy
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
1
,
9
),
0
),
Quaternion
.
identity
);
else
if
(
r
<
50
)
else
if
(
r
<
45
)
Instantiate
(
BasicEnemy
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
1
,
9
),
0
),
Quaternion
.
identity
);
else
Instantiate
(
Toluen
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
1
,
9
),
0
),
Quaternion
.
identity
);
Instantiate
(
Toluen
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
1
,
9
),
0
),
Quaternion
.
identity
);
r
=
_rand
.
Next
(
100
);
if
(
r
<
50
)
Instantiate
(
BasicEnemy
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
1
,
9
),
0
),
Quaternion
.
identity
);
}
}
}
}
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