Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Game_jam19
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Erno Lokkila
Game_jam19
Commits
8ca8d7ad
Commit
8ca8d7ad
authored
6 years ago
by
Erno Lokkila
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of gitlab.utu.fi:eolokk/game_jam19
parents
1d5a9d41
b39aeece
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Assets/Scripts/City.cs
+45
-4
45 additions, 4 deletions
Assets/Scripts/City.cs
Assets/Scripts/ResourcePool.cs
+1
-4
1 addition, 4 deletions
Assets/Scripts/ResourcePool.cs
with
46 additions
and
8 deletions
Assets/Scripts/City.cs
+
45
−
4
View file @
8ca8d7ad
...
...
@@ -5,7 +5,24 @@ using UnityEngine;
public
class
City
:
MonoBehaviour
{
[
SerializeField
]
GameObject
worker
;
[
SerializeField
]
public
int
population
=
0
;
[
SerializeField
]
public
int
populationLevel
=
0
;
[
SerializeField
]
public
int
resourcePoolLevel
=
0
;
[
SerializeField
]
public
int
roadLevel
=
0
;
[
SerializeField
]
public
int
collectorLevel
=
0
;
// Start is called before the first frame update
void
Start
()
...
...
@@ -15,12 +32,30 @@ public class City : MonoBehaviour
public
int
GetLevel
(
UpgradeTargets
target
)
{
switch
(
target
)
{
case
UpgradeTargets
.
population
:
return
this
.
populationLevel
;
case
UpgradeTargets
.
capacity
:
return
this
.
resourcePoolLevel
;
case
UpgradeTargets
.
speed
:
return
this
.
roadLevel
;
case
UpgradeTargets
.
collector
:
return
this
.
collectorLevel
;
default
:
Debug
.
Log
(
"Default"
);
return
-
1
;
break
;
}
return
1
;
}
public
void
AddCollector
()
{
GameObject
go
=
Instantiate
<
GameObject
>(
worker
);
go
.
transform
.
position
=
new
Vector3
();
}
...
...
@@ -46,7 +81,7 @@ public class City : MonoBehaviour
public
void
AddPopulation
(
int
v
)
{
this
.
population
+=
v
;
}
...
...
@@ -87,9 +122,15 @@ public class City : MonoBehaviour
{
lista
[
i
].
SetCapacity
(
x
);
}
this
.
resourcePoolLevel
++;
}
public
void
UseResources
(
List
<
int
>
a
)
{
ResourcePool
[]
lista
=
gameObject
.
GetComponents
<
ResourcePool
>();
for
(
int
i
=
0
;
i
<
lista
.
Length
;
i
++)
{
UseResource
(
lista
[
i
].
GetResource
(),
a
[
0
]);
}
}
}
This diff is collapsed.
Click to expand it.
Assets/Scripts/ResourcePool.cs
+
1
−
4
View file @
8ca8d7ad
...
...
@@ -59,8 +59,5 @@ public class ResourcePool : MonoBehaviour
{
this
.
maxCapacity
+=
x
;
}
public
void
AddCollector
()
{
Collector
c
=
gameObject
.
AddComponent
<
Collector
>();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment