public Vector3 GetNewEndTailLocation(SnakeTail tail)
 {
     if (nextTail != null)
     {
         return(nextTail.GetNewEndTailLocation(tail));
     }
     else
     {
         nextTail = tail;
         return(new Vector3(prevLoc.x, transform.position.y, prevLoc.y));
     }
 }
    public void SpawnTail(int count = 1, bool ext = true)
    {
        if (ext)
        {
            pendingTailCount += count;
            return;
        }

        GameObject tailObj = Instantiate(tailPrefab);

        tailObj.transform.position = head.GetNewEndTailLocation(tailObj.GetComponent <SnakeTail>());
        tailObj.GetComponent <SnakeTail>().speed = speed;

        SnakeTail tail = tailObj.GetComponent <SnakeTail>();

        tail.SetMatchId(networkMatchChecker.matchId);
        tail.playerIndex = playerIndex;

        NetworkServer.Spawn(tailObj);

        ClientSetSpawnedTailToEnd(playerIndex);

        pendingTailCount -= 1;
    }