public void AddTail(FollowPredecessor newTailBit) { if (successor) { successor.AddTail(newTailBit); return; } Vector3 dir = Vector3.Normalize(location.Value - location.Previous.Value); ExtendPath(dir); successor = newTailBit; successor.location = location.List.Last; successor.transform.position = successor.location.Value; successor.predecessor = this; successor.SetColor(GetComponent <Renderer>().material.color); }
public void AddTail() { GameObject newTail = Instantiate(tailPrefab); successor.AddTail(newTail.GetComponent <FollowPredecessor>()); }