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