Exemple #1
0
        public override void OnAttachedToTackObject()
        {
            base.OnAttachedToTackObject();

            m_previousPosition = new Vector2f(GetParent().Position);
            TackPhysics.GetInstance().RegisterPhysicsComponent(this);
        }
        public static void EnableDebugDrawCommand(string[] args)
        {
            if (args.Length == 1)
            {
                TackConsole.EngineLog(EngineLogType.Message, "Value: " + TackPhysics.GetInstance().ShouldDebugDrawBodies);
                return;
            }

            if (args.Length == 2)
            {
                if (bool.TryParse(args[1], out bool res))
                {
                    TackPhysics.GetInstance().ShouldDebugDrawBodies = res;
                    TackConsole.EngineLog(EngineLogType.Message, "Set {0} to Value: {1}", args[0], res);
                }
                else
                {
                    TackConsole.EngineLog(EngineLogType.Error, "Failed to convert '{0}' to a boolean value", args[1]);
                }

                return;
            }

            TackConsole.EngineLog(EngineLogType.Error, "Incorrect number of arguments for command: " + args[0]);
        }
        public void OnRender()
        {
            // Render everything in world
            RenderQuadRendererComponents();

            // Render TackPhysics debug objects
            TackPhysics.GetInstance().Render();

            // Render GUI
            m_guiInstance.OnGUIRender();
        }
Exemple #4
0
 internal virtual void AddGravityForce()
 {
     m_currentGravityForce += TackPhysics.GetInstance().Gravity *m_gravityModifier *(float)Engine.EngineTimer.LastCycleTime;
 }
Exemple #5
0
        public override void OnDetachedFromTackObject()
        {
            base.OnDetachedFromTackObject();

            TackPhysics.GetInstance().DeregisterPhysicsComponent(this);
        }