void Update() { if (pointSpawner.GetSnakeLength() > 0) { GetInput(); Move(); } }
private void OnTriggerEnter2D(Collider2D col) { if (col.transform.CompareTag("Snake")) { pointSpawner.AddBodyToList(this); transform.name = pointSpawner.GetSnakeLength().ToString(); transform.SetParent(FindObjectOfType <Snake>().transform); Vector3 _pos = GetNextPosition(); transform.position = _pos; GetComponent <CircleCollider2D>().isTrigger = false; } }