Exemple #1
0
 private void InstantiateFirstBody()
 {
     nextSnakeBodyObj = Instantiate(snakeBodyObj, transform.position, transform.rotation) as GameObject;
     nextSnakeBody    = nextSnakeBodyObj.GetComponent <ColorSnakeBody>();
     snakeLength      = 1;
     nextSnakeBody.SetAllMemember(null, snakeLength);
 }
Exemple #2
0
    //初始化方法

    private void AddOneBody()
    {
        snakeLength++;
        tSnakeBodyObj = Instantiate(snakeBodyObj, snakeTailTrans.position, snakeTailTrans.rotation) as GameObject;
        tSnakeBody    = tSnakeBodyObj.GetComponent <ColorSnakeBody>();


        tSnakeBody.SetAllMemember(snakeTail, snakeLength);

        snakeTailObj   = tSnakeBodyObj;
        snakeTail      = tSnakeBody;
        snakeTailTrans = tSnakeBodyObj.transform;
        snakeBodySpriteRenderer.sortingOrder--;
    }