Esempio n. 1
0
    private void InstantiateFirstBody()
    {
        nextSnakeBodyObj = Instantiate(snakeBodyObj, transform.position, transform.rotation) as GameObject;
        nextSnakeBody    = nextSnakeBodyObj.GetComponent <DiamondSnakeBody>();
        snakeLength      = 1;
        nextSnakeBody.SetAllMemember(null, snakeLength, null);

        snakeTail = nextSnakeBody;

        snakeBodySpriteRenderer.sortingOrder--;
    }
Esempio n. 2
0
    //***************************************************************************
    //对蛇的相关操作


    private void AddOneBody()
    {
        snakeLength++;

        DiamondGameManager.GetTheInstance().SetScore(0);
        tSnakeBodyObj = Instantiate(snakeBodyObj, snakeTail.transform.position, snakeTail.transform.rotation) as GameObject;
        tSnakeBody    = tSnakeBodyObj.GetComponent <DiamondSnakeBody>();

        tSnakeBody.SetAllMemember(snakeTail, snakeLength, null);
        snakeTail.SetNextBody(tSnakeBodyObj);
        snakeTail = tSnakeBody;
        snakeBodySpriteRenderer.sortingOrder--;//确定体节的前后覆盖关系
        DiamondGameManager.GetTheInstance().SetLenText(snakeLength);
    }