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
using UnityEngine; | |
using System.Collections; | |
[RequireComponent(typeof(Camera))] | |
public class NaplandCamera : MonoBehaviour { | |
#pragma warning disable 0414 | |
public static float minX; | |
public static float maxX; |
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
using UnityEngine; | |
using UnityEngine.UI; | |
using System.Collections; | |
using System; | |
public class InputDetector : MonoBehaviour | |
{ | |
public enum TestType { joystickButtons, keys, axis, mouse, touch } | |
public TestType testType = TestType.joystickButtons; | |
public bool logMessages = true; |
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
using UnityEngine; | |
using System.Collections.Generic; | |
public class ComponentCache | |
{ | |
public enum LogMessageLevel { all, error, none} | |
LogMessageLevel logMessageLevel = LogMessageLevel.error; | |
private GameObject _gameObject; | |
private List<Component> _components = new List<Component>(); |
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! |
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 OutputContext | |
{ | |
IOutputStrategy outputStrategy; | |
public OutputContext(IOutputStrategy outputStrategy) | |
{ | |
this.outputStrategy = outputStrategy; | |
} | |
public string GetOutput(string input) | |
{ |
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 EncryptedOutput : IOutputStrategy | |
{ | |
public string Output(string input) | |
{ | |
char[] array = input.ToCharArray(); | |
for (int i = 0; i < array.Length; i++) | |
{ | |
int number = (int)array[i]; | |
if (number >= 'a' && number <= 'z') |
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 CSVOutput : IOutputStrategy | |
{ | |
char delimiter = ' '; | |
public CSVOutput(char delimiter) | |
{ | |
this.delimiter = delimiter; | |
} | |
public string Output(string input) | |
{ |
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 interface IOutputStrategy | |
{ | |
string Output(string input); | |
} |
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
using System; | |
namespace StrategyPattern.structure | |
{ | |
abstract class Strategy | |
{ | |
public abstract void AlgorithmInterface(); | |
} | |
class ConcreteStrategyA : Strategy |
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
using UnityEngine; | |
public class TestSimpleCSVDebug : MonoBehaviour | |
{ | |
// Construct an instance of the SimpleCSVDebug class to use. | |
private SimpleCSVDebug simpleCSVDebug = new SimpleCSVDebug(); | |
void Start() | |
{ |