diff --git a/Assets/Scripts/Collector.cs b/Assets/Scripts/Collector.cs index 8279847034f59630778e7570d5baa94d33a9a64f..d772789090ed0174bacc40f72d1e189363aabf1e 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); diff --git a/Assets/Scripts/EventSystem/EventSystem.cs b/Assets/Scripts/EventSystem/EventSystem.cs index 0762879b792341ea32064fd4bc3e843a116b543d..8726731684a1ccf61644067348375e23738dc26b 100644 --- a/Assets/Scripts/EventSystem/EventSystem.cs +++ b/Assets/Scripts/EventSystem/EventSystem.cs @@ -15,9 +15,12 @@ public static class EventSystem public static void EventHappened(EventType name) { + Debug.Log("happened"); if (events.ContainsKey(name)) { - foreach (IAction e in events.Values){ + + Debug.Log("contains: "+events.Values.ToString()); + foreach (IAction e in events[name]){ e.React(name); } }