Exemple #1
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);
        }
Exemple #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);
            }
        }
Exemple #3
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();
            }
        }