private void UpdateAlpha() { //Console.WriteLine("_alpha: " + _alpha); _clearColor = Color.FromArgb(_alpha, _clearColor); _easyDraw.Clear(_clearColor); _easyDraw.Fill(_mainColor, _alpha); _easyDraw.Text(_text, _textX, _textY); }
void Update() { if (!this.Enabled) { return; } _aimDistance = TransformPoint(_crossHair.Pos.x, _crossHair.Pos.y) - _pos; _easyDrawDebug.SetActive(MyGame.Debug); if (MyGame.Debug) { _easyDrawDebug.Clear(Color.FromArgb(200, 1, 1, 1)); _easyDrawDebug.Fill(Color.White); _easyDrawDebug.Stroke(Color.Aquamarine); string str = $"state: {_state.ToString()}"; _easyDrawDebug.Text(str, 4, 30); CanvasDebugger2.Instance.DrawEllipse(x, y, _scanEnemyRange * 2, _scanEnemyRange * 2, Color.Brown); } }
public void ShowProximityInfo() { _proximityGiven = false; _proximityInfo.Text("Walk towards the stand to interact!", Input.mouseX - 250, Input.mouseY); _rectProximityInfo.Rect(Input.mouseX - 15, Input.mouseY - 30, 475, 50); foreach (AnimationSprite currentStand in LevelLoader.CollisionObjectList) { if (currentStand is MarketStand) { MarketStand stand = currentStand as MarketStand; if (stand.ProximityToStand) { _proximityGiven = true; } } } if (_proximityGiven && !_textOnceAdded) { AddChild(_rectProximityInfo); AddChild(_proximityInfo); _textOnceAdded = true; } else if (!_proximityGiven) { RemoveChild(_proximityInfo); RemoveChild(_rectProximityInfo); _textOnceAdded = false; } }
public void UpdateString(string text) { if (text == null) { return; } textContainer.Clear(Color.Transparent); textContainer.Fill(0, 0, 0); textContainer.Text(text, textContainer.width / 2, textContainer.height / 2); }
void Update() { if (!this.Enabled) { return; } if (_frameTimer >= _FrameSpeed) { SetFrame(++_frameNumber % frameCount); _frameTimer = 0; } _frameTimer += Time.deltaTime; for (int i = 0; i < _onUpdateListeners.Length; i++) { _onUpdateListeners[i].OnUpdate(this, 1); } if (_state == DroneState.END_LEVEL) { _distanceToTarget = _enemy.Pos - _pos; } _easyDrawDebug.visible = MyGame.Debug; if (MyGame.Debug) { // if (_id == 1) // { // Console.WriteLine($"========================"); // Console.WriteLine($"========================"); // Console.WriteLine($"\t{string.Join(Environment.NewLine + "\t", _iesDebug)}"); // } _easyDrawDebug.Clear(Color.FromArgb(200, 1, 1, 1)); _easyDrawDebug.Fill(Color.White); _easyDrawDebug.Stroke(Color.Aquamarine); string str = $"state: {_state.ToString()}"; _easyDrawDebug.Text(str, 4, 30); CanvasDebugger2.Instance.DrawEllipse(x, y, _detectEnemyRange * 2, _detectEnemyRange * 2, Color.Brown); CanvasDebugger2.Instance.DrawEllipse(x, y, _stopChasingRange * 2, _stopChasingRange * 2, Color.DarkGreen); DrawBoundBox(); } }
public HudScore(string filename) : base(filename, false, false) { //Hud score text //"VAGRundschriftD" _scoreLabelEasyDraw = new EasyDraw(350, 40, false); AddChild(_scoreLabelEasyDraw); //78 115 _scoreLabelEasyDraw.SetXY(60, 70); _scoreLabelEasyDraw.Clear(Color.FromArgb(1, 1, 1, 1)); _scoreLabelEasyDraw.TextFont($"data/VAGRundschriftD.ttf", 32); _scoreLabelEasyDraw.Fill(Color.White); _scoreLabelEasyDraw.TextAlign(CenterMode.Min, CenterMode.Min); _scoreLabelEasyDraw.Text($"{_score:00000000000000}", 0, 0); //"00000000000000" 14 digits }
private void BuyMenu() { if (hoveringOverStand && Input.GetMouseButtonDown(0) && !_menuShown && !MarketStand.MenuCurrentlyOpened) { LevelLoader.hud.AddChild(_buyMenu); LevelLoader.hud.AddChild(_exitButton); _menuShown = true; MarketStand.MenuCurrentlyOpened = true; } else if (MarketStand.MenuCurrentlyOpened && _menuShown && Input.GetMouseButtonDown(0) && Input.mouseX >= 1010 && Input.mouseX <= 1375 && Input.mouseY >= 275 && Input.mouseY <= 800) { LevelLoader.hud.RemoveChild(_buyMenu); LevelLoader.hud.AddChild(_buyMenu2); LevelLoader.hud.AddChild(_exitButton); MarketStand.MenuCurrentlyOpened = false; } if (_menuShown && HUD.MenuHover(_exitButton) && Input.GetMouseButtonDown(0)) { LevelLoader.hud.RemoveChild(_buyMenu); LevelLoader.hud.RemoveChild(_buyMenu2); LevelLoader.hud.RemoveChild(_exitButton); _menuShown = false; MarketStand.MenuCurrentlyOpened = false; } if (_menuShown && Input.GetMouseButtonDown(0) && Input.mouseX >= 600 && Input.mouseX <= 650 && Input.mouseY >= 380 && Input.mouseY <= 410) { _boughtItem.Text("5kg meat bought for 25$", 95, MarketStand.BuyShift); Console.WriteLine(); LevelLoader.hud.AddChild(_boughtItem); MarketStand.BuyShift += 26; } }
private void drawClock() { _clock.Text(DateTime.Now.ToShortTimeString(), 75, 87); }
void Update() { uiEasyDraw.Clear(0); uiEasyDraw.Text(_scoreText + "\n" + _timerText, 50, 50); }