예제 #1
0
    private void InstantiateFirstBody()
    {
        nextSnakeBodyObj = Instantiate(snakeBodyObj, transform.position, transform.rotation) as GameObject;
        nextSnakeBody    = nextSnakeBodyObj.GetComponent <StormSnakeBody>();
        snakeLength      = 1;
        nextSnakeBody.SetAllMemember(null, snakeLength, null);

        snakeTail = nextSnakeBody;

        snakeBodySpriteRenderer.sortingOrder--;
    }
예제 #2
0
    //***************************************************************************
    //对蛇的相关操作


    private void AddOneBody()
    {
        StormGameManager.GetTheInstance().SetScore(0);

        snakeLength++;
        tSnakeBodyObj = Instantiate(snakeBodyObj, snakeTail.transform.position, snakeTail.transform.rotation) as GameObject;
        tSnakeBody    = tSnakeBodyObj.GetComponent <StormSnakeBody>();

        tSnakeBody.SetAllMemember(snakeTail, snakeLength, null);
        snakeTail.SetNextBody(tSnakeBodyObj);
        snakeTail = tSnakeBody;

        snakeBodySpriteRenderer.sortingOrder--;
        StormGameManager.GetTheInstance().SetLenText(snakeLength);
    }