public void Add(int head, int tail) { Heads.Add(head); Tails.Add(tail); HeadsTails.Add(new KeyValuePair <int, int>(head, tail)); CreateArcList(); }
protected override void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Barrier") { OnHitBarrier(); } if (collision.gameObject.tag == "Border") { SceneManager.LoadScene(0); } if (collision.gameObject.tag == "Food") { Color32 objColor; objColor = collision.gameObject.GetComponent <MeshRenderer>().material.color; Destroy(collision.gameObject); var bone = Instantiate(BonePrefab); bone.GetComponent <Renderer>().material.color = objColor; Tails.Add(bone.transform); Speed *= 1.1f; if (OnEat != null) { OnEat.Invoke(); } if (Tails.Count >= 3) { RemoveBone(); } } }
private void SetTails() { // explicit set for safety Tails.Clear(); if (SelectedGroup != null && SelectedGroup.Logs.Any()) { foreach (var tail in SelectedGroup.Logs .Select(log => new TailFile(log))) { Tails.Add(tail); } } }
public void AddTail(GameObject tail) { if (Tails.Count == 0) { tail.transform.position = transform.position + Vector3.left; tail.name = "Tail 1"; } else { tail.transform.position = Tails[Tails.Count - 1].transform.position + Vector3.left; tail.name = $"Tail {Tails.Count + 1}"; } Tails.Add(tail); TailsLength++; }