Example #1
0
    public void SetCollectingSnake(Snake snake)
    {
        if (collectingSnake != snake && collectingSnake != null)
        {
            //StartCoroutine (collectingSnake.Die ());
            collectingSnake.tailGroundPieces.Remove(this);              // REMOVING FROM OLD SNAKE
        }

        collectingSnake = snake;
        snake.tailGroundPieces.Add(this);
        tailPiece.gameObject.SetActive(true);

        if (snake.currentMoveDirection.x == 1 && snake.currentMoveDirection.y == 0)
        {
            tailPiece.transform.rotation = Quaternion.Euler(0, 0, 270);
        }
        else if (snake.currentMoveDirection.x == -1 && snake.currentMoveDirection.y == 0)
        {
            tailPiece.transform.rotation = Quaternion.Euler(0, 0, 90);
        }
        if (snake.currentMoveDirection.x == 0 && snake.currentMoveDirection.y == 1)
        {
            tailPiece.transform.rotation = Quaternion.Euler(0, 0, 0);
        }
        else if (snake.currentMoveDirection.x == 0 && snake.currentMoveDirection.y == -1)
        {
            tailPiece.transform.rotation = Quaternion.Euler(0, 0, 180);
        }

        tailPiece.originalColor = snake.spriteColor;
        tailPiece.SetSPrite(snake.tailPieceSprite);
    }
Example #2
0
    public void SetCollectingSnake(Snake snake)
    {
        if (collectingSnake != snake && collectingSnake != null)
        {
            collectingSnake.tailGroundPieces.Remove(this);              // REMOVING FROM OLD SNAKE
        }

        collectingSnake = snake;
        snake.tailGroundPieces.Add(this);
        tailPiece.gameObject.SetActive(true);

        tailPiece.originalColor = snake.spriteColor;
        tailPiece.SetSPrite(snake.tailPieceSprite);
    }