public override void Update() { Screen.AppendChar(9, gameObject.transform.position, ' '); if (AllowMovement) { //Screen.ClearLayer(8); //Screen.AppendString(8, new Vector2(0, 0), $"Debug (combat): Time left: {TimeInSecondsToClose}"); if (TimeInSecondsToClose <= 0f) { DestroyMe = true; } if (Input.GetKeyDown(ConsoleKey.LeftArrow)) { if (!Screen.IsColliding(6, gameObject.transform.position + (Vector2.left * Time.deltaTime * speed))) { gameObject.transform.translate(Vector2.left * Time.deltaTime * speed); } } if (Input.GetKeyDown(ConsoleKey.UpArrow)) { if (!Screen.IsColliding(6, gameObject.transform.position + (Vector2.up * Time.deltaTime * speed * 2f))) { gameObject.transform.translate(Vector2.up * Time.deltaTime * speed * 2f); } } if (Input.GetKeyDown(ConsoleKey.RightArrow)) { if (!Screen.IsColliding(6, gameObject.transform.position + (Vector2.right * Time.deltaTime * speed))) { gameObject.transform.translate(Vector2.right * Time.deltaTime * speed); } } if (!Screen.IsColliding(6, gameObject.transform.position + (Vector2.down * Time.deltaTime * (speed / 2)))) { gameObject.transform.translate(Vector2.down * Time.deltaTime * (speed / 2)); } TimeInSecondsToClose -= Time.deltaTime / 10; } if (Visible) { Screen.AppendChar(9, gameObject.transform.position, '♥', ConsoleColor.Red); } }
void EffectSlowtype(string text, sbyte modifier) { int speed = 50; switch (modifier) { case 1: speed = 200; break; case 2: speed = 100; break; case 3: speed = 50; break; case 4: speed = 25; break; case 5: speed = 10; break; } char[] chars = text.ToCharArray(); for (int i = 0; i < chars.Length; i++) { //Console.Beep(200, 250); Thread.Sleep(speed); if (chars[i] == tagOpener) { string workerString = text.Substring(i + 1, text.Length - 1 - i); int closeTag = workerString.IndexOf(tagCloser); workerString = workerString.Substring(0, closeTag); sbyte type = -1, subtype = -1; if (workerString.Contains(tagEquals) || workerString.Contains(tagClosure)) { for (sbyte i2 = 0; i2 < nestedtags.Length; i2++) { if (workerString.StartsWith(nestedtags[i2][0])) { type = i2; for (sbyte i3 = 0; i3 < nestedtags[i2].Length; i3++) { if (workerString.EndsWith(nestedtags[i2][i3])) { subtype = i3; } } break; } else if (workerString.StartsWith($"{tagClosure}{nestedtags[i2][0]}")) { type = i2; subtype = -1; break; } } } if (type > -1) { SubtypeTextEffects(type, subtype); i += closeTag + 2; } } // Check if the character was new line and reset CursorLeft to our defined location byte Char = Convert.ToByte(chars[i]); if (Char == 0x0A || Char == 0x0D) { currentPoint.Y++; currentPoint.X = DefaultTextLeft; Console.CursorLeft = DefaultTextLeft; continue; } ; Screen.AppendChar((int)Screen.ScreenLayer.UIText2, new Vector2(currentPoint.X, currentPoint.Y), chars[i], cc); currentPoint.X++; } }
public override void OnDelete() { Screen.AppendChar(9, gameObject.transform.position, ' '); Screen.ClearLayer(8); }
public override void Awake() { gameObject.transform.position = new Vector2(Screen.Width / 2 - 1, Screen.Height - 10); Screen.AppendChar(9, gameObject.transform.position, '♥', ConsoleColor.Red); }