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
f73e4ff9
Commit
f73e4ff9
authored
Oct 25, 2016
by
Naliwe GS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small fixes
parent
b33d8e90
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
60 deletions
+33
-60
Player.prefab
Assets/Prefabs/Player.prefab
+0
-0
Player.prefab.meta
Assets/Prefabs/Player.prefab.meta
+8
-0
Collectible.cs
Assets/Scripts/Collectible.cs
+3
-1
GameController.cs
Assets/Scripts/GameController.cs
+13
-54
Player.cs
Assets/Scripts/Player.cs
+3
-0
SimpleEnnemy.cs
Assets/Scripts/SimpleEnnemy.cs
+2
-1
Spawner.cs
Assets/Scripts/Spawner.cs
+3
-3
StaticEnemy.cs
Assets/Scripts/StaticEnemy.cs
+1
-1
No files found.
Assets/Prefabs/Player.prefab
0 → 100644
View file @
f73e4ff9
File added
Assets/Prefabs/Player.prefab.meta
0 → 100644
View file @
f73e4ff9
fileFormatVersion: 2
guid: b8da779ffb69b984dbd3e41d6e16ffbb
timeCreated: 1477389059
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/Collectible.cs
View file @
f73e4ff9
...
...
@@ -17,7 +17,8 @@ public class Collectible : MonoBehaviour
void
OnTriggerEnter2D
(
Collider2D
other
)
{
gameObject
.
SetActive
(
false
);
Destroy
(
gameObject
);
_player
.
GetComponent
<
Player
>().
Score
+=
10
;
_player
.
GetComponent
<
Player
>().
Progression
+=
1
;
}
}
\ No newline at end of file
Assets/Scripts/GameController.cs
View file @
f73e4ff9
...
...
@@ -5,52 +5,23 @@ using System;
namespace
Assets.Scripts
{
internal
class
CADelegates
{
static
System
.
Random
r
=
new
System
.
Random
();
public
static
bool
CanGrow
(
Cell
cell
)
{
if
(
cell
.
Position
.
y
==
0
)
return
true
;
if
(
cell
.
Position
.
x
%
4
==
0
)
return
cell
.
Position
.
y
<
16
&&
((
100
/
cell
.
Position
.
y
))
>
6
+
r
.
Next
(
94
);
return
false
;
}
}
public
class
GameController
:
MonoBehaviour
{
public
static
int
PoolSize
=
256
;
public
GameObject
Wall
;
public
GameObject
BG
;
private
Map
_map
;
private
ObjectPool
_pooledWalls
;
private
ObjectPool
_pooledActors
;
private
ObjectPool
_pooledProjectiles
;
private
CellularAutomaton
_ca
;
private
GameObject
[]
_tiles
;
private
Vector3
size
;
private
Transform
tra
;
private
int
mult
=
1
;
void
Start
()
{
// _map = new Map(128, 128);
// _pooledActors = new ObjectPool(PoolSize);
// _pooledProjectiles = new ObjectPool(PoolSize);
// _pooledWalls = new ObjectPool(PoolSize);
// _ca = new CellularAutomaton(_map, TileType.Wall) {CanGrowRule = CADelegates.CanGrow};
// _tiles = new GameObject[_map.Columns*_map.Rows];
// for (uint i = 0; i < _map.Columns*_map.Rows; i++)
// {
// _tiles[i] = (GameObject) Instantiate(Wall, new Vector3(0, 0, 0), Quaternion.identity);
// _tiles[i].SetActive(false);
// }
size
=
BG
.
GetComponent
<
SpriteRenderer
>().
sprite
.
bounds
.
size
;
tra
=
BG
.
GetComponent
<
Transform
>();
}
void
Update
()
...
...
@@ -59,28 +30,17 @@ namespace Assets.Scripts
var
rightBorder
=
Camera
.
main
.
ScreenToWorldPoint
(
new
Vector3
(
Screen
.
width
,
Screen
.
height
,
0
)).
x
;
var
leftBorder
=
Camera
.
main
.
ScreenToWorldPoint
(
new
Vector3
(
0
,
0
,
0
)).
x
;
if
(
rightBorder
>
(
size
.
x
-
2
)
*
mult
)
{
BG
=
(
GameObject
)
Instantiate
(
BG
,
new
Vector3
(
size
.
x
+
tra
.
position
.
x
-
.
5f
,
tra
.
position
.
y
,
0
),
Quaternion
.
identity
);
tra
=
BG
.
GetComponent
<
Transform
>();
mult
++;
}
// _ca.Step(rightBorder);
// DrawMap(leftBorder, rightBorder);
// Debug.Log(_map);
}
void
DrawMap
(
float
min
,
float
max
)
{
for
(
uint
y
=
0
;
y
<
_map
.
Rows
;
y
++)
{
for
(
uint
x
=
(
uint
)
min
%
_map
.
Columns
;
x
<
max
+
1
%
_map
.
Columns
;
x
++)
{
if
(
_map
[
x
,
y
]
==
TileType
.
Wall
)
{
var
tile
=
_tiles
[
_map
.
Columns
*
y
+
x
];
var
newX
=
(
uint
)
(
min
/
_map
.
Columns
)*
_map
.
Columns
+
x
;
tile
.
transform
.
position
=
new
Vector3
(
newX
,
y
,
0
);
tile
.
SetActive
(
true
);
}
}
}
}
}
}
\ No newline at end of file
Assets/Scripts/Player.cs
View file @
f73e4ff9
...
...
@@ -10,6 +10,7 @@ namespace Assets.Scripts
public
int
Score
=
0
;
public
int
Battery
=
100
;
public
int
Progression
=
0
;
public
bool
IsBlinking
=
false
;
void
Start
()
...
...
@@ -41,11 +42,13 @@ namespace Assets.Scripts
if
(
_blinkCount
!=
7
)
return
;
_blinkCount
=
0
;
_blinkTimer
=
0f
;
GetComponent
<
BoxCollider2D
>().
enabled
=
true
;
IsBlinking
=
false
;
}
public
void
SetBlinking
()
{
GetComponent
<
BoxCollider2D
>().
enabled
=
false
;
GetComponent
<
SpriteRenderer
>().
enabled
=
false
;
IsBlinking
=
true
;
}
...
...
Assets/Scripts/SimpleEnnemy.cs
View file @
f73e4ff9
...
...
@@ -29,9 +29,10 @@ public class SimpleEnnemy : MonoBehaviour
void
OnTriggerEnter2D
(
Collider2D
other
)
{
gameObject
.
SetActive
(
false
);
Destroy
(
gameObject
);
_player
.
GetComponent
<
Player
>().
Battery
-=
4
;
_player
.
GetComponent
<
Player
>().
SetBlinking
();
//GetScores(); TODO: Successfully get scores from API
}
...
...
Assets/Scripts/Spawner.cs
View file @
f73e4ff9
...
...
@@ -34,10 +34,10 @@ public class Spawner : MonoBehaviour
var
r
=
_rand
.
Next
(
100
);
if
(
r
<
20
)
Instantiate
(
Toluen
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
9
),
0
),
Quaternion
.
identity
);
Instantiate
(
Toluen
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
1
,
9
),
0
),
Quaternion
.
identity
);
else
if
(
r
<
50
)
Instantiate
(
BasicEnemy
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
9
),
0
),
Quaternion
.
identity
);
Instantiate
(
BasicEnemy
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
1
,
9
),
0
),
Quaternion
.
identity
);
else
Instantiate
(
StaticEnemy
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
9
),
0
),
Quaternion
.
identity
);
Instantiate
(
StaticEnemy
,
new
Vector3
(
_rightBorder
,
_rand
.
Next
(
1
,
9
),
0
),
Quaternion
.
identity
);
}
}
Assets/Scripts/StaticEnemy.cs
View file @
f73e4ff9
...
...
@@ -17,7 +17,7 @@ public class StaticEnemy : MonoBehaviour
{
if
(
_position
.
position
.
x
<
Camera
.
main
.
ScreenToWorldPoint
(
new
Vector3
(
0
,
0
,
0
)).
x
)
{
gameObject
.
SetActive
(
false
);
Destroy
(
gameObject
);
}
}
...
...
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