From 5aa6ac5aa0d5a72d46425e6f7111ebdd17eee148 Mon Sep 17 00:00:00 2001
From: Petteri <jupean@utu.fi>
Date: Sun, 3 Mar 2019 10:56:55 +0200
Subject: [PATCH] collector update

---
 Assets/Scripts/Collector.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Assets/Scripts/Collector.cs b/Assets/Scripts/Collector.cs
index 8279847..d772789 100644
--- a/Assets/Scripts/Collector.cs
+++ b/Assets/Scripts/Collector.cs
@@ -53,7 +53,7 @@ public class Collector : MonoBehaviour
                 MoveTo(hit.collider.gameObject);
             }
         }
-        if (target != null)
+        if (move_to != null)
             transform.position = Vector3.MoveTowards(new Vector3(transform.position.x, transform.position.y, -1f), move_to.transform.position, speed * Time.deltaTime);
     }
     private void OnTriggerEnter2D(Collider2D collision)
@@ -67,7 +67,7 @@ public class Collector : MonoBehaviour
             this.resource = this.target.GetComponent<Resource>();
             StartCoroutine("goHome");
         }
-        else if (collision.gameObject.name == "City" && this.resource != null)
+        else if (collision.gameObject.tag == "Home" && this.resource != null)
         {
             //resets amount and resource variables
             collision.gameObject.GetComponent<City>().AddResource(this.resource, this.amount);
-- 
GitLab