示例#1
0
文件: Graph.cs 项目: holymosh/labs
 public void Add(int head, int tail)
 {
     Heads.Add(head);
     Tails.Add(tail);
     HeadsTails.Add(new KeyValuePair <int, int>(head, tail));
     CreateArcList();
 }
示例#2
0
    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();
            }
        }
    }
示例#3
0
 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);
         }
     }
 }
示例#4
0
 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++;
 }