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
Leevi Grönlund
Game_jam19
Commits
7e385915
Commit
7e385915
authored
6 years ago
by
Petteri
Browse files
Options
Downloads
Patches
Plain Diff
Collector changes
Added getting resource
parent
97734498
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Assets/Scenes/MainScene.meta
+8
-0
8 additions, 0 deletions
Assets/Scenes/MainScene.meta
Assets/Scenes/MainScene.unity
+4
-123
4 additions, 123 deletions
Assets/Scenes/MainScene.unity
Assets/Scripts/Collector.cs
+19
-3
19 additions, 3 deletions
Assets/Scripts/Collector.cs
with
31 additions
and
126 deletions
Assets/Scenes/MainScene.meta
0 → 100644
+
8
−
0
View file @
7e385915
fileFormatVersion: 2
guid: 829c46be4b50d504a8fd053e72cf24e3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
Click to expand it.
Assets/Scenes/MainScene.unity
+
4
−
123
View file @
7e385915
...
...
@@ -1344,8 +1344,10 @@ MonoBehaviour:
m_EditorClassIdentifier
:
target
:
{
fileID
:
0
}
move_to
:
{
fileID
:
0
}
max_amount
:
10
amount
:
0
home
:
{
fileID
:
471348698
}
resource
:
{
fileID
:
0
}
speed
:
1
---
!u!61
&932290493
BoxCollider2D
:
...
...
@@ -1473,126 +1475,6 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
10
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!1
&1379725508
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
1379725511
}
-
component
:
{
fileID
:
1379725510
}
-
component
:
{
fileID
:
1379725509
}
-
component
:
{
fileID
:
1379725512
}
m_Layer
:
0
m_Name
:
Tree (2)
m_TagString
:
Resource
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&1379725509
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1379725508
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
bad3649e66714d14d94d87cd3e47c1a1
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Amount
:
20
---
!u!212
&1379725510
SpriteRenderer
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1379725508
}
m_Enabled
:
1
m_CastShadows
:
0
m_ReceiveShadows
:
0
m_DynamicOccludee
:
1
m_MotionVectors
:
1
m_LightProbeUsage
:
1
m_ReflectionProbeUsage
:
1
m_RenderingLayerMask
:
1
m_RendererPriority
:
0
m_Materials
:
-
{
fileID
:
10754
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_StaticBatchInfo
:
firstSubMesh
:
0
subMeshCount
:
0
m_StaticBatchRoot
:
{
fileID
:
0
}
m_ProbeAnchor
:
{
fileID
:
0
}
m_LightProbeVolumeOverride
:
{
fileID
:
0
}
m_ScaleInLightmap
:
1
m_PreserveUVs
:
0
m_IgnoreNormalsForChartDetection
:
0
m_ImportantGI
:
0
m_StitchLightmapSeams
:
0
m_SelectedEditorRenderState
:
0
m_MinimumChartSize
:
4
m_AutoUVMaxDistance
:
0.5
m_AutoUVMaxAngle
:
89
m_LightmapParameters
:
{
fileID
:
0
}
m_SortingLayerID
:
0
m_SortingLayer
:
0
m_SortingOrder
:
0
m_Sprite
:
{
fileID
:
21300000
,
guid
:
473e801b3bc9651409881d3f975c23ef
,
type
:
3
}
m_Color
:
{
r
:
1
,
g
:
1
,
b
:
1
,
a
:
1
}
m_FlipX
:
0
m_FlipY
:
0
m_DrawMode
:
0
m_Size
:
{
x
:
1.28
,
y
:
1.28
}
m_AdaptiveModeThreshold
:
0.5
m_SpriteTileMode
:
0
m_WasSpriteAssigned
:
1
m_MaskInteraction
:
0
m_SpriteSortPoint
:
0
---
!u!4
&1379725511
Transform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1379725508
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
2.87
,
y
:
-1.7186036
,
z
:
-0.1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
20
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!61
&1379725512
BoxCollider2D
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1379725508
}
m_Enabled
:
1
m_Density
:
1
m_Material
:
{
fileID
:
0
}
m_IsTrigger
:
1
m_UsedByEffector
:
0
m_UsedByComposite
:
0
m_Offset
:
{
x
:
0
,
y
:
0
}
m_SpriteTilingProperty
:
border
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
0
}
pivot
:
{
x
:
0.5
,
y
:
0.5
}
oldSize
:
{
x
:
1.28
,
y
:
1.28
}
newSize
:
{
x
:
1.28
,
y
:
1.28
}
adaptiveTilingThreshold
:
0.5
drawMode
:
0
adaptiveTiling
:
0
m_AutoTiling
:
0
serializedVersion
:
2
m_Size
:
{
x
:
1.28
,
y
:
1.28
}
m_EdgeRadius
:
0
---
!u!1
&1667231311
GameObject
:
m_ObjectHideFlags
:
0
...
...
@@ -1682,8 +1564,8 @@ GameObject:
m_Component
:
-
component
:
{
fileID
:
1699889077
}
-
component
:
{
fileID
:
1699889076
}
-
component
:
{
fileID
:
1699889075
}
-
component
:
{
fileID
:
1699889078
}
-
component
:
{
fileID
:
1699889075
}
m_Layer
:
0
m_Name
:
Tree (1)
m_TagString
:
Resource
...
...
@@ -1700,10 +1582,9 @@ MonoBehaviour:
m_GameObject
:
{
fileID
:
1699889074
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
bad3649e66714d14d94d87cd3e47c
1a
1
,
type
:
3
}
m_Script
:
{
fileID
:
11500000
,
guid
:
cb94cfa918a502245a4097b174928
1a
d
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
Amount
:
0
---
!u!212
&1699889076
SpriteRenderer
:
m_ObjectHideFlags
:
0
...
...
This diff is collapsed.
Click to expand it.
Assets/Scripts/Collector.cs
+
19
−
3
View file @
7e385915
...
...
@@ -7,15 +7,17 @@ public class Collector : MonoBehaviour
// Start is called before the first frame update
void
Start
()
{
}
[
SerializeField
]
private
GameObject
target
;
[
SerializeField
]
private
GameObject
move_to
;
[
SerializeField
]
private
int
max_amount
=
10
;
[
SerializeField
]
private
int
amount
;
...
...
@@ -23,6 +25,8 @@ public class Collector : MonoBehaviour
[
SerializeField
]
private
GameObject
home
;
[
SerializeField
]
private
Resource
resource
;
public
float
speed
=
1
;
...
...
@@ -57,15 +61,27 @@ public class Collector : MonoBehaviour
}
private
void
OnTriggerEnter2D
(
Collider2D
collision
)
{
Debug
.
Log
(
collision
.
gameObject
.
name
);
if
(
collision
.
gameObject
.
tag
==
"Resource"
)
{
//Amount of resources worker is carrying right now
this
.
amount
=
collision
.
gameObject
.
GetComponent
<
Resource
>().
extractResource
(
this
.
max_amount
);
//Gives target resource to resource variable
this
.
resource
=
this
.
target
.
GetComponent
<
Resource
>();
StartCoroutine
(
"goHome"
);
}
else
if
(
collision
.
gameObject
.
name
==
"City"
)
{
//resets amount and resource variables
this
.
amount
=
0
;
this
.
resource
=
null
;
MoveTo
(
this
.
target
);
}
}
IEnumerator
goHome
()
{
yield
return
new
WaitForSeconds
(
4
);
MoveTo
(
home
);
}
}
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