Skip to content
Snippets Groups Projects
Commit 7356a539 authored by Kimi Heinonen's avatar Kimi Heinonen
Browse files

Merge branch 'master' of https://gitlab.utu.fi/eolokk/game_jam19

parents 39ea8de4 fdb88788
No related branches found
No related tags found
No related merge requests found
Showing
with 449 additions and 41 deletions
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4334850820553036048
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2388334960364419616}
m_Layer: 0
m_Name: GameWin
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2388334960364419616
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4334850820553036048}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.5898275, y: 3.887589, z: 0.94433594}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
fileFormatVersion: 2
guid: 80a61f8911aa37046a2d5e13d579c221
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -13,8 +13,8 @@ GameObject:
- component: {fileID: 5733991913862907517}
- component: {fileID: 7985519473791055737}
m_Layer: 0
m_Name: StoneResource
m_TagString: Resource
m_Name: Outcrop
m_TagString: Buildable
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......@@ -94,7 +94,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
wood: 0
quarry: {fileID: 0}
--- !u!61 &7985519473791055737
BoxCollider2D:
m_ObjectHideFlags: 0
......
......@@ -185,7 +185,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 834199860}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 5.2034483, y: 2.3731437, z: 0}
m_LocalPosition: {x: -0.16, y: -2.91, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
......@@ -264,7 +264,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1242906259}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -5.3051963, y: 2.9021022, z: 0}
m_LocalPosition: {x: 5.65, y: 1.53, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
......@@ -343,7 +343,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1334682652}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -3.89, y: -3.87, z: 0}
m_LocalPosition: {x: -5.34, y: -2.93, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
......@@ -359,6 +359,8 @@ GameObject:
m_Component:
- component: {fileID: 1346472592}
- component: {fileID: 1346472591}
- component: {fileID: 1346472594}
- component: {fileID: 1346472593}
m_Layer: 0
m_Name: ExitButton
m_TagString: Untagged
......@@ -403,8 +405,8 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Color: {r: 0.990566, g: 0, b: 0, a: 1}
m_Sprite: {fileID: 21300002, guid: 96af674e67bc4b521aa75450c40dfcbf, type: 3}
m_Color: {r: 0.8980393, g: 0.8980393, b: 0.8980393, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
......@@ -422,12 +424,52 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1346472590}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -1.22, z: 0.058931645}
m_LocalScale: {x: 20, y: 5, z: 1}
m_LocalPosition: {x: 2.5, y: 0, z: 0.058931645}
m_LocalScale: {x: 3, y: 3, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &1346472593
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1346472590}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
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, y: 1}
newSize: {x: 0.16, y: 0.16}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!114 &1346472594
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1346472590}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6b987107b9a225144a51d7e298dbf2aa, type: 3}
m_Name:
m_EditorClassIdentifier:
playButton: {fileID: 1377888703}
exitButton: {fileID: 1346472590}
--- !u!1 &1377888703
GameObject:
m_ObjectHideFlags: 0
......@@ -438,6 +480,8 @@ GameObject:
m_Component:
- component: {fileID: 1377888705}
- component: {fileID: 1377888704}
- component: {fileID: 1377888707}
- component: {fileID: 1377888708}
m_Layer: 0
m_Name: PlayButton
m_TagString: Untagged
......@@ -482,8 +526,8 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Color: {r: 0.013082923, g: 0.9245283, b: 0.18797691, a: 1}
m_Sprite: {fileID: 21300000, guid: 96af674e67bc4b521aa75450c40dfcbf, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
......@@ -501,12 +545,131 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1377888703}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.14, z: 0.058931645}
m_LocalScale: {x: 20, y: 5, z: 1}
m_LocalPosition: {x: -2.5, y: 0, z: 0.058931645}
m_LocalScale: {x: 3, y: 3, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1377888707
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1377888703}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6b987107b9a225144a51d7e298dbf2aa, type: 3}
m_Name:
m_EditorClassIdentifier:
playButton: {fileID: 1377888703}
exitButton: {fileID: 1346472590}
--- !u!61 &1377888708
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1377888703}
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, y: 1}
newSize: {x: 0.16, y: 0.16}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 1, y: 1}
m_EdgeRadius: 0
--- !u!1 &1490674628
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1490674630}
- component: {fileID: 1490674629}
m_Layer: 0
m_Name: rock (4)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &1490674629
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1490674628}
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: 1
m_Sprite: {fileID: 21300000, guid: 2d5618b5caec3c7d6bac162c4cd0a034, 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, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &1490674630
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1490674628}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -5.29, y: 2.63, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1507413978
GameObject:
m_ObjectHideFlags: 0
......@@ -580,7 +743,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1507413978}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 4.25, y: -2.0348446, z: 0}
m_LocalPosition: {x: 5.62, y: -2.75, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
......@@ -640,8 +803,8 @@ SpriteRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: fe463401d3186b54086acff6bb82891f, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Color: {r: 1, g: 0.9111515, b: 0.6084906, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
......@@ -659,8 +822,8 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1807990412}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.08, y: -0.1, z: 0}
m_LocalScale: {x: 13, y: 10, z: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 150, y: 100, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
......
......@@ -13,6 +13,15 @@ public class Collector : MonoBehaviour
[SerializeField]
private int max_amount = 10;
[SerializeField]
private int Requested_amount;
[SerializeField]
private Resource Requested_resource;
[SerializeField]
private bool OnkoVapaa;
[SerializeField]
private int amount;
......@@ -26,6 +35,8 @@ public class Collector : MonoBehaviour
[SerializeField]
private GameObject target_flag;
[SerializeField]
private bool send_to_resource;
public GameObject flag;
// Start is called before the first frame update
void Start()
......@@ -33,6 +44,14 @@ public class Collector : MonoBehaviour
home = GameObject.FindGameObjectWithTag("Home");
}
public void SetOnkoVapaa(bool vapaa)
{
this.OnkoVapaa = vapaa;
}
public bool tarkistaVapaus()
{
return this.OnkoVapaa;
}
public void SetTarget(GameObject target)
{
this.target = target;
......@@ -41,10 +60,18 @@ public class Collector : MonoBehaviour
{
this.move_to = target;
}
public Resource getResource()
{
return this.resource;
}
public void SetSend_to_resource(bool r)
{
this.send_to_resource = r;
}
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
......@@ -53,6 +80,16 @@ public class Collector : MonoBehaviour
RaycastHit2D hit = Physics2D.Raycast(mousePos2D, Vector2.zero);
if (hit.collider != null)
{
if (hit.collider.gameObject.tag == "Home")
home.gameObject.GetComponent<City>().AddCollector();
if (hit.collider.gameObject.GetComponent<Outcrop>() != null)
{
this.send_to_resource = true;
}
else
{
this.send_to_resource = false;
}
DestroyImmediate(target_flag);
target_flag = Instantiate(flag, hit.point, Quaternion.identity);
target_flag.GetComponent<Flag>().SetWorker(this.gameObject);
......@@ -72,30 +109,51 @@ public class Collector : MonoBehaviour
if(collision.gameObject.transform.position == target_flag.transform.position) {
if(resource == null)
{
/*if(target.GetComponent<Resource>().vie_tavaraa())
if(home.GetComponent<BoxCollider2D>().bounds.Contains(new Vector3(target_flag.transform.position.x, target_flag.transform.position.y,home.transform.position.z)))
{
Destroy(target_flag);
}
else if (send_to_resource && target.GetComponent<Outcrop>())
{
if(this.amount > 0)
target.GetComponent<Outcrop>().setAmount(this.amount);
//Requested_resource = target.GetComponent<Outcrop>();
Requested_amount = target.GetComponent<Outcrop>().stillNeeded();
StartCoroutine("goHome");
}
else
{*/
{
//Amount of resources worker is carrying right now
this.amount = target.GetComponent<Resource>().extractResource(this.max_amount);
//Gives target resource to resource variable
this.resource = this.target.GetComponent<Resource>();
//}
StartCoroutine("goHome");
}
}
StartCoroutine("goHome");
else
StartCoroutine("goHome");
}
}
if (collision.gameObject.tag == "Home" && this.resource != null)
if (move_to.gameObject.tag == "Home" && this.resource != null)
{
//resets amount and resource variables
collision.gameObject.GetComponent<City>().AddResource(this.resource, this.amount);
this.amount = 0;
this.resource = null;
MoveTo(this.target);
if (target.GetComponent<Outcrop>())
{
/*if(this.Requested_amount < this.max_amount)
this.amount = home.GetComponent<City>().UseResource(, this.Requested_amount);
else
this.amount = home.GetComponent<City>().UseResource(, this.max_amount);*/
}
else
{
//resets amount and resource variables
collision.gameObject.GetComponent<City>().AddResource(this.resource, this.amount);
this.amount = 0;
this.resource = null;
}
MoveTo(this.target);
}
}
IEnumerator goHome()
......
fileFormatVersion: 2
guid: cf62eacc43e8a40469118b61f12a5364
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveRandomly : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
StartCoroutine("moveAround");
}
private IEnumerator moveAround() {
while (true)
{
float moveTime = Random.value * 2;
float timeSpent = 0;
Vector3 direction = new Vector3(Random.value*2-1,Random.value*2-1, 0);
while (timeSpent < moveTime)
{
transform.position = transform.position + direction*0.01f;
yield return null;
timeSpent += Time.deltaTime;
}
}
}
}
fileFormatVersion: 2
guid: d3063605b31636c4e9998676be17db5d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WinGame : MonoBehaviour
{
[SerializeField]
private GameObject housePrefab = null;
[SerializeField]
private GameObject workerPrefab = null;
private List<GameObject> houses = new List<GameObject>();
void Start()
{
StartCoroutine("MoveCamera");
StartCoroutine("EndGame");
}
private IEnumerator MoveCamera()
{
while (Camera.main.orthographicSize < 9f) {
Camera.main.orthographicSize += 0.01f;
yield return null;
}
}
private IEnumerator EndGame()
{
float spawnRate = 5f;
int count = 0;
while (count < 9)
{
GameObject go = Instantiate<GameObject>(housePrefab);
houses.Add(go);
go.transform.position = new Vector3(Random.Range(1f, 14f), Random.Range(1f, 14f),-5);
spawnRate -= 0.5f;
yield return new WaitForSeconds(spawnRate);
count++;
}
for (int i = 0; i < 3; i++) {
GameObject go = Instantiate<GameObject>(housePrefab);
houses.Add(go);
go.transform.position = new Vector3(Random.Range(1f, 14f), Random.Range(1f, 14f), -5);
yield return new WaitForSeconds(spawnRate);
}
count = 0;
while (count < 150)
{
GameObject go = Instantiate<GameObject>(workerPrefab);
int index = Random.Range(0, houses.Count);
go.transform.position = houses[index].transform.position;
go.AddComponent<MoveRandomly>();
Destroy(go.GetComponent<Collector>());
Destroy(go.GetComponent<Rigidbody2D>());
yield return new WaitForSeconds(0.1f);
count++;
}
}
}
fileFormatVersion: 2
guid: d3674a5cdecf6e14abe5d88e6f0f7618
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -151,7 +151,7 @@ public class GroundGenerator : MonoBehaviour
private void createHome() {
ground[ground.GetLength(0) / 2, ground.GetLength(1) / 2] = home;
spawn(homeGO, houseCoords[0], houseCoords[1], houseDepth);
spawn(workerGO, houseCoords[0], houseCoords[1], workerDepth);
homeGO.GetComponent<City>().AddCollector();
}
private GameObject spawn(GameObject go, int x, int y, int z) {
return Instantiate<GameObject>(go, new Vector3(x, y, z), Quaternion.identity);
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MenuSript : MonoBehaviour
{
[SerializeField]
private GameObject playButton;
[SerializeField]
private GameObject exitButton;
private void OnMouseDown() {
if (gameObject == exitButton) {
Application.Quit();
}
if (gameObject == playButton) {
UnityEngine.SceneManagement.SceneManager.LoadScene(1);
}
}
}
fileFormatVersion: 2
guid: 6b987107b9a225144a51d7e298dbf2aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -74,12 +74,6 @@ public class Forest : Resource
StartCoroutine("Grow");
}
// Update is called once per frame
void Update()
{
}
IEnumerator Grow()
{
while (getAmount() < 1000)
......
......@@ -11,6 +11,7 @@ public class Outcrop : MonoBehaviour
private int woodNeeded = 100;
private GameObject quarry;
public Resource neededResource;
public int getAmount()
{
......@@ -48,6 +49,9 @@ public class Outcrop : MonoBehaviour
void Start()
{
setAmount(0);
GameObject go = new GameObject();
neededResource = go.AddComponent<Forest>();
neededResource.enabled = false;
}
// Update is called once per frame
......
......@@ -44,7 +44,7 @@ public class Quarry : Resource
// Start is called before the first frame update
void Start()
{
setEventType(EventType.StoneCut);
setAmount(Random.Range(2000, 4000));
}
......
Assets/Sprites/Cloud.png

2.25 KiB

Assets/Sprites/Destination_b.png

2.5 KiB

Assets/Sprites/Destination_pointer.png

2.71 KiB

No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment