Esempio n. 1
0
        private void UpdateAlpha()
        {
            //Console.WriteLine("_alpha: " + _alpha);

            _clearColor = Color.FromArgb(_alpha, _clearColor);
            _easyDraw.Clear(_clearColor);
            _easyDraw.Fill(_mainColor, _alpha);
            _easyDraw.Text(_text, _textX, _textY);
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 3
0
        public HudSlider(int width, int height, float startValue = 1.0f, bool addCollider = true) : base(width, height, addCollider)
        {
            Clear(Color.DarkGray);

            _fore = new EasyDraw(width - 4, height - 4, false);
            _fore.SetOrigin(0, -_fore.height / 2f);
            _fore.Clear(Color.LightGray);
            AddChild(_fore);

            _fore.x = 2;
            _fore.y = -_fore.height * 0.5f + 2;

            _thumb = new EasyDraw(10, height, false);
            _thumb.Clear(Color.Aqua);
            _thumb.Fill(Color.White);
            _thumb.Stroke(Color.Black);
            _thumb.ShapeAlign(CenterMode.Min, CenterMode.Min);
            _thumb.Rect(0, 0, _thumb.width - 1, height - 1);
            AddChild(_thumb);

            _thumb.x = 0;
            _thumb.y = 0;

            _thumb.SetOrigin(_thumb.width * 0.5f, 0);
        }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
        private void CreateBlankScreen()
        {
            var blankScreen = new EasyDraw(Game.main.width, Game.main.height);

            blankScreen.NoStroke();
            blankScreen.Fill(Color.Black);
            blankScreen.ShapeAlign(CenterMode.Min, CenterMode.Min);
            blankScreen.Rect(0, 0, blankScreen.width, blankScreen.height);
            AddChild(blankScreen);
        }
Esempio n. 6
0
        public Menu(string type, Color bgColor)
        {
            bg = new EasyDraw(game.width, game.height, false);
            bg.ShapeAlign(CenterMode.Min, CenterMode.Min);
            bg.Fill(bgColor);
            bg.Rect(0, 0, bg.width, bg.height);
            AddChild(bg);

            this.type = type;
            SetType(type);
        }
Esempio n. 7
0
        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();
            }
        }
Esempio n. 8
0
        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
        }