JigsawPiece.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    void Update()
    {
        // If we dont have a jigsaw piece, dont do anything
        if(!NextJigsawPiece)
            return;

        // If the trigger has been activated, dont do anything else
        if(!IsActivated)
            return;

        // If we have created the next piece, dont do anything else
        if(NextPieceGenerated)
            return;

        // Create a new gameobject for the next piece in the path
        NextJigsawPieceAccess = (GameObject)GameObject.Instantiate(NextJigsawPiece, NextJigsawPiece.transform.position - (Vector3.up * 10), NextJigsawPiece.transform.rotation);

        // Add the transform to specify where it needs to move to
        TransformGeometry Transformer = NextJigsawPieceAccess.AddComponent<TransformGeometry>();
        Transformer.TransformTarget[0] = NextJigsawPiece.transform;

        // Flag that we have generated it
        NextPieceGenerated = true;
    }