// Update is called once per frame void Update() { if (!gc.paused) { if (!gottheshaman) { dir = (shaman.transform.position - transform.position).normalized; transform.position += dir * speed * Time.deltaTime; if (Vector2.Distance(transform.position, shaman.transform.position) <= TakeDistance) { shaman.transform.parent = transform; Shaman sh = shaman.GetComponent <Shaman>(); sh.Activate(false); sh.enabled = false; gottheshaman = true; } } else { dir = (fleepoint.transform.position - transform.position).normalized; transform.position += dir * speed * Time.deltaTime; if (Vector2.Distance(transform.position, fleepoint.transform.position) <= TakeDistance) { shaman.GetComponent <Shaman>().dse.Open(); parent.SetActive(false); } } } }