public void ResetProfile() { Profile.InitEmpty(); SaveProfile(); DebugDisplay.AddDecayLine("Profile reset", 5f, 1f, 1f); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. //spriteBatch = new SpriteBatch(GraphicsDevice); DebugDisplay.Initialize(_graphic.Renderer); }
public void UpdateLedgeDetectorState(Vector3 pos) { const float bodyRadius = PlayerConstants.BODY_RADIUS; const float distance = 0.13f; // TODO: Add comments, some of them clever. RaycastHit?ceilingHit = CylinderPhysics.CircleCast( pos, bodyRadius, BIG_NUMBER, Vector3.up ); float ceilingHeight = ceilingHit?.distance ?? BIG_NUMBER; Vector3 echoStart = pos + (Vector3.up * ceilingHeight); RaycastHit?echoHit = CylinderPhysics.CircleCast( echoStart, bodyRadius + distance, BIG_NUMBER, Vector3.down ); LedgePresent = echoHit.HasValue; if (LedgePresent) { DebugDisplay.DrawPoint(Color.green, echoHit.Value.point); LastLedgeHeight = echoHit.Value.point.y - pos.y; } }
public void FixedUpdate() { DebugDisplay.PrintLine($"Rise: {PlayerConstants.JUMP_RISE_GRAVITY}"); DebugDisplay.PrintLine($"Fall: {PlayerConstants.FREE_FALL_GRAVITY}"); // Many states use collision status(eg: are we touching the ground?) // to decide if they should change to a different state. // We need to update this information before Motor.UpdateCollisionStatus(); // Run state logic that needs to be done early. // Usually, this is where state transitions happen. _currentState.EarlyFixedUpdate(); // Run the current state's main logic. // Note that CurrentState may have been changed by EarlyFixedUpdate() _currentState.FixedUpdate(); // Tell the motor to move at its current velocity. Motor.Move(); // Display debugging metrics DebugDisplay.PrintLine("HSpeed: " + HSpeed); DebugDisplay.PrintLine("VSpeed: " + Motor.RelativeVSpeed); DebugDisplay.PrintLine("HAngleDeg: " + HAngleDeg); DebugDisplay.PrintLine("Double jump armed: " + DoubleJumpArmed); DebugDisplay.PrintLine("In double jump window: " + IsInDoubleJumpWindow()); DebugDisplay.PrintLine("Jump height: " + (_debugJumpMaxY - LastJumpStartPos.y)); }
public override void Update() { if (!_paused) { SpawnMonster(); DebugDisplay.Write("Entities.Count", this.EntityCount.ToString()); base.Update(); } }
void Update() { DebugDisplay.PrintLine(_input.RightStick.ToString()); // Adjust the angles with the right stick Vector3 rightStick = _input.RightStick; if (INVERT_HORIZONTAL) { rightStick.x *= -1; } if (INVERT_VERTICAL) { rightStick.y *= -1; } _hAngleDeg += rightStick.x * MAX_ROTSPEED_DEG * Time.deltaTime; _vAngleDeg += rightStick.y * MAX_ROTSPEED_DEG * Time.deltaTime; if (_vAngleDeg > MAX_VANGLE_DEG) { _vAngleDeg = MAX_VANGLE_DEG; } if (_vAngleDeg < MIN_VANGLE_DEG) { _vAngleDeg = MIN_VANGLE_DEG; } // Calculate the where the position would be (if we didn't zoom) Vector3 dir = SphericalToCartesian(_hAngleDeg, _vAngleDeg, 1); Vector3 pos = _target.position + (dir * ORBIT_RADIUS); // Zoom in if the view is obstructed float targetZoomDistance = GetZoomDistance( pos, _target.position, _target.position + (Vector3.up * PlayerConstants.BODY_HEIGHT) ); float zoomSpeed = targetZoomDistance < _zoomDistance ? ZOOM_IN_SPEED : ZOOM_OUT_SPEED; _zoomDistance = Mathf.MoveTowards( _zoomDistance, targetZoomDistance, zoomSpeed * Time.deltaTime ); pos = _target.position + (_zoomDistance * dir); // Jump to the position and look at the thing transform.position = pos; transform.LookAt(_target); }
private void FixedUpdate() { Vector3 p = m_Camera.ViewportToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, m_Camera.nearClipPlane)); DebugDisplay.Log("Screen mouse pos: " + Input.mousePosition.ToString()); DebugDisplay.Log("World mouse pos: " + p.ToString()); // Move the camera towards a desired position. Move(); }
private void Awake() { debugText = GetComponent <TextMeshProUGUI>(); if (Instance != null && Instance != this) { Debug.LogError("There is another copy of this singleton", gameObject); } else { Instance = this; } }
internal static void Draw(int2 xy, int2 wh) { DebugDisplay.Instantiate(); var unit = Unmanaged.Instance.Data.m_TextBufferAllocations.AllocateAtomic(1); if (unit.Length == 0) { return; } var text = Unmanaged.Instance.Data.m_TextBuffer; text.SetTextBox(xy, wh, unit.m_Next); }
void Update() { DebugDisplay.PrintLine("Delta time: " + (Time.time / Time.frameCount)); DebugDisplay.PrintLine("Animation speed: " + _animator.speed); _model.rotation = TweenUtils.DecayTowards( _model.rotation, GetTargetRot(), TWEEN_HALF_LIFE, Time.deltaTime ); UpdateBones(); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); float frameRate = 1 / (float)gameTime.ElapsedGameTime.TotalSeconds; DebugDisplay.Write("fps", frameRate.ToString()); DebugDisplay.Commit(); _graphic.Draw(); base.Draw(gameTime); }
void Update() { // DEBUG: Draw the box if (_displayTimer > 0) { DebugDisplay.DrawCube( Color.red, GetBoxCenter(), GetBoxHalfExtents(), GetBoxOrientation() ); } _displayTimer -= Time.deltaTime; }
public override void Update() { if (GameHost.debugDisplay) { if (this.LifePoint <= 0) { DebugDisplay.Write("Collision avec Player", "PLAYER MORT !!"); } else { DebugDisplay.Write("Collision avec Player", this.World.Physic.GetEntitiesWhichCollidesWith(this).Count.ToString()); } } base.Update(); }
public void SetDebugDisplay(bool _displayOn) { if (!_displayOn) { if (_debugDisplay != null) { _debugDisplay.QueueFree(); _debugDisplay = null; } } else if (_debugDisplay == null) { _debugDisplay = (DebugDisplay)_debugDisplayScene.Instance(); CanvasLayer.AddChild(_debugDisplay); } }
/// <summary> /// Creates a new Director instance using the specified Game. /// </summary> /// <param name="game">Game instance for the Director to use.</param> /// <param name="preferredResolution">Preferred resolution for game graphics.</param> /// <remarks>Protected to prevent instantiating Director instances outside of the static SharedDirector property.</remarks> protected Director(Game game, Vector2 preferredResolution) : base(game) { if (preferredResolution == null) { throw new ArgumentNullException("defaultResolution"); } PreferredResolution = preferredResolution; DisplaySize = preferredResolution; DisplayCenter = new Vector2(DisplaySize.X / 2.0f, DisplaySize.Y / 2.0f); ResolutionIndependent = false; TransformationMatrix = new Matrix(); EntityWorld = new EntityWorld(game); RenderSystem renderSystem = EntityWorld.SystemManager.SetSystem <RenderSystem>(new RenderSystem(), SystemExecutionType.Draw); AnimationSystem animationSystem = EntityWorld.SystemManager.SetSystem <AnimationSystem>(new AnimationSystem(), SystemExecutionType.Update); MovementSystem movementSystem = EntityWorld.SystemManager.SetSystem <MovementSystem>(new MovementSystem(), SystemExecutionType.Update); ControlSystem controlSystem = EntityWorld.SystemManager.SetSystem <ControlSystem>(new ControlSystem(), SystemExecutionType.Update); MessageBoard = new MessageBoard(game); GameStateManager = new GameStateManager(game.Services); InputManager = new InputManager(game.Services); InputBindingManager = new InputBindingManager(game); TextureManager = new TextureManager(game.Content); FontManager = new FontManager(game.Content); GuiManager = new GuiManager(game.Services); game.Components.Add(EntityWorld); game.Components.Add(MessageBoard); game.Components.Add(InputManager); game.Components.Add(InputBindingManager); game.Services.AddService(typeof(IEntityWorld), EntityWorld); game.Services.AddService(typeof(IMessageBoard), MessageBoard); game.Services.AddService(typeof(IInputBindingManager), InputBindingManager); game.Services.AddService(typeof(ITextureManager), TextureManager); game.Services.AddService(typeof(IFontManager), FontManager); #if DEBUG DebugDisplay = new DebugDisplay(game); game.Components.Add(DebugDisplay); game.Services.AddService(typeof(IDebugDisplay), DebugDisplay); #endif }
/// <summary> /// Called if the scene is activated. /// </summary> public override void OnSceneActivated() { _entityComposer = new EntityComposer(); _scoreBoard = new Scoreboard(); _debugDisplay = new DebugDisplay(_entityComposer) { Visible = false }; _minimap = new Minimap(_entityComposer); _blackBlend = new BlackBlend { FadeIn = true }; //load achievements var xmlManager = new XmlManager <AchievementManager>(); try { _entityComposer.AchievementManager = xmlManager.Load(Path.Combine(Environment.CurrentDirectory, "achievements.xml")); } catch { _entityComposer.AchievementManager = new AchievementManager(); _entityComposer.AchievementManager.Achievements.Add(new EnemyDestroyedAchievement()); _entityComposer.AchievementManager.Achievements.Add(new ScoreAchievement()); _entityComposer.AchievementManager.Achievements.Add(new SustainAchievement()); _entityComposer.AchievementManager.Achievements.Add(new LasterTimeAchievement()); System.Diagnostics.Debug.WriteLine("Unable to load achievements."); } _achievementControl = new AchievementControl(UIManager); _achievementControl.Visible = false; _achievementsOpen = false; _achievementControl.AchievementManager = _entityComposer.AchievementManager; #if AUDIO_ENABLED //AudioManager.Instance.Sound.Play(SGL.QueryResource<Sound>("gameMusic.mp3"), PlayMode.Loop); #endif }
public void Update() { if (Input.JumpPressed) { LastJumpButtonPressTime = Time.time; } if (Input.AttackPressed) { LastAttackButtonPressTime = Time.time; } // Let the animator know our rotation Anim.HAngleDeg = HAngleDeg; // DEV CHEAT: slow down time with a button DebugDisplay.PrintLine("CheatSlowTime: " + UnityEngine.Input.GetAxisRaw("CheatSlowTime")); Time.timeScale = Input.CheatSlowTimeHeld ? 0.25f : 1; }
internal Lines(int count) { DebugDisplay.Instantiate(); m_Unit = Unmanaged.Instance.Data.m_LineBufferAllocations.AllocateAtomic(count); }
/* * Object could call this from their functions by: * this.GetComponent<Whisp>().Say("Hello from the other side."); */ void Start() { _dl = GameObject.Find("DebugLog"); _debugLog = (DebugDisplay)_dl.GetComponent(typeof(DebugDisplay)); }
public void Awake() { _instance = this; }
private void Awake() { instance = this; OnDebugMessageDisplayed += DebugMessageDisplayed; DebugParent.SetActive(false); }
//The main loop that will process the effects of the game. If it needs inputs, it will flag what // it's waiting on and pull input from the network buffer to decide what action should be taken public IEnumerator CRMatchLoop() { //Do any animation processing that needs to be done before the match processing actually starts yield return(StartCoroutine(CRPrepMatch())); //Initially decide if we want to do any fast forwarding from early loaded input HandleFastForwarding(); //Do any initial processing for beginning of match effects yield return(ProcessStackUntilInputNeeded()); //Keep processing effects while the match isn't finished while (!IsMatchOver()) { // At this point, we should have an input field that's been set up that needs to be filled out Debug.Assert(matchinputToFillOut != null); bool bNeedsLocalInput = false; //If we need input, let's check if we already have input waiting in our buffer for that input if (NetworkMatchReceiver.Get().IsCurMatchInputReady() == false) { // Now that input is needed by some player, check if we locally control that player if (NetworkMatchSetup.IsLocallyOwned(matchinputToFillOut.iPlayerActing)) { bNeedsLocalInput = true; //Let the match input prepare to start gathering manual input matchinputToFillOut.StartManualInputProcess(); } else { //If we don't locally control the player who needs to decide an input DebugDisplay.Get().SetDebugText("Waiting for foreign input"); } //Wait until we have input waiting for us in the network buffer while (NetworkMatchReceiver.Get().IsCurMatchInputReady() == false) { //Keep spinning until we get the input we're waiting on DebugDisplay.Get().SetDebugText("Waiting for input"); yield return(null); } //Do any cleanup that we need to do if we were waiting on input //TODO - figure out what needs to be done and under what circumstances - careful of potentially changing local input controllers if (bNeedsLocalInput == true) { //Have the match input let the local input controller know that we're done with gathering input matchinputToFillOut.EndManualInputProcess(); } } //Check if we should be master forwarding through our inputs if we have a bunch stacked up waiting to be processed (like from loading a log file or reconnecting) HandleFastForwarding(); //At this point, we have an input in the buffer that we are able to process MatchInput matchinput = NetworkMatchReceiver.Get().GetCurMatchInput(); //Make a record of which input we're going to be processing in our logs LogManager.Get().LogMatchInput(matchinput); //Clear out the matchinput we prompting to be filled out matchinputToFillOut = null; //Process that match input by deferring to its execute method yield return(matchinput.Execute()); //The execute method should have pushed new executables/clauses onto the stack, so we can process them // Pass control over to the stack-processing loop until it needs player input to continue the simulation yield return(ProcessStackUntilInputNeeded()); //Since we're done processing all the effects that may need access to the most recent input, we can advance to the next needed input NetworkMatchReceiver.Get().FinishCurMatchInput(); } //Do any animation process that needs to be done before we leave the match scene yield return(StartCoroutine(CRCleanUpMatch())); //Do any fill wrap-up for the match FinishMatch(); }