public static void RenderTerminal(SimpleTerminal term, float3 pos = default) { var mat = DefaultMat; var matrix = Matrix4x4.TRS(pos, Quaternion.identity, Vector3.one); Graphics.DrawMesh(term.Mesh, matrix, mat, 0); }
void Scramble(SimpleTerminal term) { new ScrambleJob { Tiles = term.Tiles, Random = new Unity.Mathematics.Random((uint)UnityEngine.Random.Range(1, int.MaxValue)) }.Run(); }
public void Resize() { var term = new SimpleTerminal(10, 10, Temp); Assert.AreEqual(10, term.Width); Assert.AreEqual(10, term.Height); term.Resize(30, 5); Assert.AreEqual(30, term.Width); Assert.AreEqual(5, term.Height); }
public void SetGet() { var term = new SimpleTerminal(10, 10, Temp); term.Set(7, 5, Color.blue, Color.green, 'a'); var t = term.Get(7, 5); Assert.AreEqual(Color.blue, t.fgColor); Assert.AreEqual(Color.green, t.bgColor); Assert.AreEqual('a', t.glyph); }
public static void AdjustCameraToTerminal(SimpleTerminal term) { var cam = Object.FindObjectOfType <TiledCamera>(); if (cam == null) { var mainCam = Camera.main; cam = mainCam.gameObject.AddComponent <TiledCamera>(); } cam.TileSize = new int2(8, 8); cam.TileCount = term.Size; }
private void OnEnable() { _term = new SimpleTerminal(_size.x, _size.y, Allocator.Persistent); _term.ImmediateUpdate(); _aspectTerm = new SimpleTerminal(_size.x, _size.y, Allocator.Persistent); _aspectTerm.ImmediateUpdate(); _term.Print(0, 0, "Hello!"); _aspectTerm.Print(0, 0, "Hello!"); _aspectTerm.WithTileSize(new float2(.5f, 1)); }
public void WriteRead() { var term = new SimpleTerminal(40, 15, Temp); term.Print(0, 0, "Hello"); var tiles = term.ReadTiles(0, 0, 5, Temp); Assert.AreEqual('H', ToChar(tiles[0].glyph)); Assert.AreEqual('e', ToChar(tiles[1].glyph)); Assert.AreEqual('l', ToChar(tiles[2].glyph)); Assert.AreEqual('l', ToChar(tiles[3].glyph)); Assert.AreEqual('o', ToChar(tiles[4].glyph)); }
private void OnEnable() { _term = new SimpleTerminal(10, 10, Allocator.Temp); //_term.Resize(20, 20); }
private void OnEnable() { _term = new SimpleTerminal(80, 60, Allocator.Persistent); //DrawCircle(); }
// Start is called before the first frame update void Start() { _term = new SimpleTerminal(10, 10, Allocator.Persistent); RenderUtility.AdjustCameraToTerminal(_term); }