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
ea6c9887
Commit
ea6c9887
authored
6 years ago
by
Kimi Heinonen
Browse files
Options
Downloads
Patches
Plain Diff
Worker lisatty city prefabiin
parent
8f234ae7
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Assets/Prefab/City.prefab
+2
-1
2 additions, 1 deletion
Assets/Prefab/City.prefab
Assets/Scripts/City.cs
+15
-3
15 additions, 3 deletions
Assets/Scripts/City.cs
Assets/Scripts/ResourcePool.cs
+4
-0
4 additions, 0 deletions
Assets/Scripts/ResourcePool.cs
with
21 additions
and
4 deletions
Assets/Prefab/City.prefab
+
2
−
1
View file @
ea6c9887
...
...
@@ -119,7 +119,8 @@ MonoBehaviour:
m_Script
:
{
fileID
:
11500000
,
guid
:
dfe928a858872424991e927606dd4bc3
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
worker
:
{
fileID
:
0
}
workerlista
:
[]
worker
:
{
fileID
:
548039319383633024
,
guid
:
7dc194a2047a39340a91ca7636a56290
,
type
:
3
}
population
:
0
populationLevel
:
0
resourcePoolLevel
:
0
...
...
This diff is collapsed.
Click to expand it.
Assets/Scripts/City.cs
+
15
−
3
View file @
ea6c9887
...
...
@@ -5,6 +5,9 @@ using UnityEngine;
public
class
City
:
MonoBehaviour
{
[
SerializeField
]
List
<
GameObject
>
workerlista
;
[
SerializeField
]
GameObject
worker
;
...
...
@@ -20,16 +23,18 @@ public class City : MonoBehaviour
[
SerializeField
]
public
int
roadLevel
=
0
;
[
SerializeField
]
public
int
collectorLevel
=
0
;
// Start is called before the first frame update
void
Start
()
{
}
/**
* Palauttaa kysytyn targetin levelin
*/
public
int
GetLevel
(
UpgradeTargets
target
)
{
switch
(
target
)
...
...
@@ -41,7 +46,7 @@ public class City : MonoBehaviour
case
UpgradeTargets
.
speed
:
return
this
.
roadLevel
;
case
UpgradeTargets
.
collector
:
return
this
.
collectorLevel
;
return
this
.
workerlista
.
Count
;
default
:
Debug
.
Log
(
"Default"
);
return
-
1
;
...
...
@@ -50,12 +55,19 @@ public class City : MonoBehaviour
return
1
;
}
/**
* Lisaa uuden collecotrin
*/
public
void
AddCollector
()
{
GameObject
go
=
Instantiate
<
GameObject
>(
worker
);
this
.
workerlista
.
Add
(
go
);
go
.
transform
.
position
=
new
Vector3
();
this
.
population
++;
}
...
...
This diff is collapsed.
Click to expand it.
Assets/Scripts/ResourcePool.cs
+
4
−
0
View file @
ea6c9887
...
...
@@ -59,5 +59,9 @@ public class ResourcePool : MonoBehaviour
{
this
.
maxCapacity
+=
x
;
}
public
int
GetMaxCapacity
()
{
return
this
.
maxCapacity
;
}
}
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