Created
December 30, 2015 18:14
-
-
Save Naphier/184ea641245378a8efb3 to your computer and use it in GitHub Desktop.
Strategy Pattern Example - String Output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OutputStrategyController : MonoBehaviour | |
{ | |
public string input = "This is some arbitrary input string"; | |
void Start() | |
{ | |
OutputContext context = new OutputContext(new CSVOutput(' ')); | |
Debug.Log("This is the CSV output:\n" + context.GetOutput(input)); | |
//Easily change the context! | |
context = new OutputContext(new EncryptedOutput()); | |
Debug.Log("This is the encrypted output:\n" + context.GetOutput(input)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment