Ejemplo n.º 1
0
    void OnEnable()
    {
        // init the serial connections
        axiomserialController.Init();
        bfPedalController.Init();
        bfWheelController.Init();
        bfTiltController.Init();

        layerIndices = new Dictionary <Layers, int>();

        smoothingMethod      = SmoothingMethod.Average;
        wheelSmooth          = new float[wheelSmoothFactor];
        invWheelSmoothFactor = 1f / wheelSmoothFactor;

        //- debug

        profiler = GameProfiler.Get("GameProfiler");
        var settings = profiler.Add("Raw");

        settings.min = 0;
        settings.max = 60;
        var settings2 = profiler.Add("Median");

        settings2.min = 0;
        settings2.max = 60;
        var settings3 = profiler.Add("Mean");

        settings3.min = 0;
        settings3.max = 60;
    }
Ejemplo n.º 2
0
    void OnEnable()
    {
        profiler = GameProfiler.Get("GameProfiler");
        var settings = profiler.Add("notReadyCounter");

        settings.min    = 0;
        settings.max    = 100;
        settings.height = 401;
    }
Ejemplo n.º 3
0
    public void SelectProfiler()
    {
        profiler = AssetDatabase.LoadAssetAtPath(Project.GameManagerPath + "GameProfiller.asset", typeof(GameProfiler)) as GameProfiler;

        if (profiler == null)
        {
            profiler = ScriptableObject.CreateInstance <GameProfiler>();
            AssetDatabase.CreateAsset(profiler, Project.GameManagerPath + "GameProfiller.asset");
            AssetDatabase.SaveAssets();
        }
    }
Ejemplo n.º 4
0
        public void Execute(TState state)
        {
            StateLogger.LogStateChanged(this, State, state);

            GameProfiler.BeginSample("Stop state");
            Stop();
            GameProfiler.EndSample();

            State = state;
            StateEnter(State);

            GameProfiler.BeginSample("ExecuteState");
            _executor.Execute(state);
            GameProfiler.EndSample();
        }
 public void Execute(IAsyncStateBehaviour state)
 {
     GameProfiler.BeginSample("Stop state");
     Stop();
     GameProfiler.EndSample();
     if (state == null)
     {
         Debug.LogErrorFormat("State Machine State NULL not exists in current context");
         return;
     }
     GameLog.LogFormat(ExecuteStateTemplate, _color, state);
     GameProfiler.BeginSample("ExecuteState");
     ExecuteState(state);
     GameProfiler.EndSample();
 }
Ejemplo n.º 6
0
    public static IGameProfiler Get(string name)
    {
        GameObject obj = GameObject.Find(name);

        if (obj == null)
        {
            //+ Debug.LogWarning("Couldn't find GameObject '" + name + "'");
        }
        else
        {
            GameProfiler profiler = obj.GetComponent <GameProfiler>();
            if (profiler == null)
            {
                Debug.LogWarning("GameObject '" + name + "' doesn't have a GameProfiler component");
            }
            else
            {
                return(profiler);
            }
        }
        return(emptyProfiler);
    }
Ejemplo n.º 7
0
    void OnEnable()
    {
        profiler = GameProfiler.Get("GameProfiler");
        if (profiler.GetCount() < 19)
        {
            pos = transform.position;

            string id       = name + " speed";
            var    settings = profiler.Add(id);
            settings.min    = 0;
            settings.max    = maxSpeed;
            settings.height = 201;

            if (isSimulationElement)
            {
                id              = name + " target speed";
                settings        = profiler.Add(id);
                settings.min    = 0;
                settings.max    = maxSpeed;
                settings.height = 101;

                id              = name + " acceleration";
                settings        = profiler.Add(id);
                settings.min    = -0.2f;
                settings.max    = 0.2f;
                settings.height = 101;

                simElement = GetComponent <SimulationElement>();
            }
        }
        else
        {
            profiler = null;
            enabled  = false;
        }
    }
Ejemplo n.º 8
0
        public override async Task Execute()
        {
            if (Enabled)
            {
                GameProfiler.EnableProfiling();
            }

            while (Game.IsRunning)
            {
                GameProfiler.TextColor         = TextColor;
                GameProfiler.RefreshTime       = RefreshTime;
                GameProfiler.SortingMode       = SortingMode;
                GameProfiler.FilteringMode     = FilteringMode;
                GameProfiler.CurrentResultPage = ResultPage;
                ResultPage = GameProfiler.CurrentResultPage;

                if (Input.IsKeyDown(Keys.LeftShift) && Input.IsKeyDown(Keys.LeftCtrl) && Input.IsKeyReleased(Keys.P))
                {
                    if (Enabled)
                    {
                        GameProfiler.DisableProfiling();
                        Enabled = false;
                    }
                    else
                    {
                        GameProfiler.EnableProfiling();
                        Enabled = true;
                    }
                }

                if (Enabled)
                {
                    // Toggle the filtering mode
                    if (Input.IsKeyPressed(Keys.F1))
                    {
                        FilteringMode = (GameProfilingResults)(((int)FilteringMode + 1) % Enum.GetValues(typeof(GameProfilingResults)).Length);
                    }
                    // Toggle the sorting mode
                    if (Input.IsKeyPressed(Keys.F2))
                    {
                        SortingMode = (GameProfilingSorting)(((int)SortingMode + 1) % Enum.GetValues(typeof(GameProfilingSorting)).Length);
                    }

                    // Update the result page
                    if (Input.IsKeyPressed(Keys.F3))
                    {
                        ResultPage = Math.Max(1, --ResultPage);
                    }
                    else if (Input.IsKeyPressed(Keys.F4))
                    {
                        ++ResultPage;
                    }
                    if (Input.IsKeyPressed(Keys.D1))
                    {
                        ResultPage = 1;
                    }
                    else if (Input.IsKeyPressed(Keys.D2))
                    {
                        ResultPage = 2;
                    }
                    else if (Input.IsKeyPressed(Keys.D3))
                    {
                        ResultPage = 3;
                    }
                    else if (Input.IsKeyPressed(Keys.D4))
                    {
                        ResultPage = 4;
                    }
                    else if (Input.IsKeyPressed(Keys.D5))
                    {
                        ResultPage = 5;
                    }

                    // Update the refreshing speed
                    if (Input.IsKeyPressed(Keys.Subtract) || Input.IsKeyPressed(Keys.OemMinus))
                    {
                        RefreshTime = Math.Min(RefreshTime * 2, 10000);
                    }
                    else if (Input.IsKeyPressed(Keys.Add) || Input.IsKeyPressed(Keys.OemPlus))
                    {
                        RefreshTime = Math.Max(RefreshTime / 2, 100);
                    }
                }

                await Script.NextFrame();
            }
        }