示例#1
0
    public void AddCHild()
    {
        GameObject newTail = Instantiate(followerPrefab, this.transform.position, Quaternion.identity);

        this.snakeFollow           = newTail.GetComponent <snakeFollower>();
        snakeFollow.isTail         = true;
        snakeFollow.speed          = this.speed;
        snakeFollow.head           = head;
        snakeFollow.parent         = this.transform;
        snakeFollow.followerPrefab = this.followerPrefab;
        snakeFollow.direction      = this.direction;
        this.isTail = false;
    }
 void AddSnake()
 {
     if (Tail == null)
     {
         GameObject newTail = Instantiate(followerPrefab, this.transform.position, Quaternion.identity);
         this.snakeTail           = newTail.GetComponent <snakeFollower>();
         snakeTail.isTail         = true;
         snakeTail.head           = this;
         snakeTail.speed          = this.speed;
         snakeTail.parent         = this.transform;
         snakeTail.followerPrefab = this.followerPrefab;
         snakeTail.direction      = this.direction;
     }
     else
     {
         Tail.AddCHild();
     }
 }