void Attract() { foreach (GameObject attractable in GameObject.FindGameObjectsWithTag("Attractable")) { attractable.GetComponent <Rigidbody2D>().AddForce((FitInScreenHelper.GetDirection(transform.position, attractable.transform.position) * 35f * Time.deltaTime)); } }
// Update is called once per frame void Update() { if (player != null) { dist = FitInScreenHelper.GetDistance(transform.position, player.transform.position); } sprRndr.color = initColor * dist + Color.white * (1 - dist); }