protected new void Awake() { base.Awake(); (coll = GetComponent <CircleCollider2D>()).enabled = false; (rend = GetComponent <SpriteRenderer>()).enabled = false; preSpiked = colorlib.GetSpriteColored(vars.teamcolor, preSpiked, colorlib.colortochange); Spiked = colorlib.GetSpriteColored(vars.teamcolor, Spiked, colorlib.colortochange); rend.sprite = preSpiked; cooldownTimer = 2.5f; if (vars.gameObject == globalvariables.playergameobject) { targetgui = somefunctions.InstantiatePrefabTr("gui/targetinterface", transform).GetComponent <TargetInterface>(); targetgui.setCentre(transform); targetgui.gameObject.SetActive(false); } }
static void Main(string[] args) { AdapterByInterface ad = new AdapterByInterface(); // To do something with ad ... TargetInterface tInterface = ad; tInterface.OnGUI(); SourceClass sc = new SourceClass(); // To do something with sc TargetClass tClass = new AdapterByClass(sc); tClass.OnGUI(); Console.ReadKey(); }
static int Main(string[] args) { string err = null; string rootPath = null; string fileFilter = null; int tab = 4; TargetInterface target = TargetInterface.Terminal; DrawWith drawWith = DrawWith.Graphic; Ordering ordering = Ordering.None; for (var ix = 0; ix < args.Length; ++ix) { var arg = args[ix]; if (arg == "/?") { ShowUsage(); return(0); } else if (arg == "/A") { drawWith = DrawWith.Ascii; } else if (arg == "/F") { fileFilter = "*"; } else if (arg == "/SL") { ordering = Ordering.Lexical; } else if (arg == "/SN") { ordering = Ordering.Natural; } else if (arg == "/W") { target = TargetInterface.Browser; } else if (arg.StartsWith("/")) { bool isOk = Int32.TryParse(arg.Substring(1), out int tryTab); if (isOk && tryTab > 0) { tab = tryTab; } else { Console.WriteLine($"Invalid switch - {args[ix]}"); return(1); } } else if (rootPath != null) { Console.WriteLine($"Too many parameters - {args[ix]}"); return(2); } else { rootPath = arg; } } if (rootPath == null) { rootPath = "."; } try { if (target == TargetInterface.Terminal) { foreach (string lx in DirNode.Vector.GenerateTextTree(rootPath, fileFilter, drawWith, ordering, tab)) { Console.WriteLine(lx); } } else { foreach (string lx in DirVectorHtml.GenerateHtmlTree(rootPath, fileFilter, drawWith, ordering, tab)) { Console.WriteLine(lx); } } } catch (IOException ex) { err = ex.Message.Trim(); } catch (UnauthorizedAccessException ex) { err = ex.Message.Trim(); } if (err != null) { Console.Error.WriteLine(err); return(1); } return(0); }