public void DrawText(SpriteBatch spriteBatch) { var fontY = 10; foreach (var Character in _CharacterSprite) { spriteBatch.DrawString(_font, string.Format("Direction: {0} Velocity: {1} Slipping:{2}", VectorOps.Vector2ToDeg(Character.Direction), Character.VelocityInform, Character.isSlip), new Vector2(10, fontY += 20), Color.Black); } spriteBatch.DrawString(_font, string.Format("Mouse Position: {0}", new Vector2(Mouse.GetState().X, Mouse.GetState().Y)), new Vector2(10, fontY += 20), Color.Black); spriteBatch.DrawString(_font, string.Format("SlimeTimer: {0}", _timer1), new Vector2(10, fontY += 20), Color.Black); spriteBatch.DrawString(_font, string.Format("Screen Dimensions: {0}", new Vector2(widthscreen, heightscreen)), new Vector2(10, fontY += 20), Color.Black); spriteBatch.DrawString(_font, string.Format("WheelMouse: {0}", Mouse.GetState().ScrollWheelValue), new Vector2(10, fontY += 20), Color.Black); }
//Apartat de les animacions protected virtual void SetAnimations() { if (isHit) { float angle = VectorOps.Vector2ToDeg(Direction); //Animació de ser colpejat per la salt if (angle < 315 && angle > 225) { _animationManager.Play(_animations["Slug up hit"]); } else if (angle >= 315 || angle < 45) { _animationManager.Play(_animations["Slug right hit"]); } else if (angle <= 225 && angle > 135) { _animationManager.Play(_animations["Slug left hit"]); } else { _animationManager.Play(_animations["Slug down hit"]); } } else { // Detecció del angle de dispar amb la corresponent animació (probablement s'haurà de fer de forma més eficient) // Angle entre animacions: 18 graus || pi/10 radiants -- Desfasament: 9 graus || pi/20 radiant float angle = VectorOps.Vector2ToDeg(Direction); if ((angle <= 9 && angle >= 0) || (angle <= 360 && angle > 351)) { _animationManager.Play(_animations["Slug right0"]); } else if (angle <= 27 && angle > 9) { _animationManager.Play(_animations["Slug right-22_5"]); } else if (angle <= 45 && angle > 27) { _animationManager.Play(_animations["Slug right-45"]); } else if (angle <= 63 && angle > 45) { _animationManager.Play(_animations["Slug down45"]); } else if (angle <= 81 && angle > 63) { _animationManager.Play(_animations["Slug down22_5"]); } else if (angle <= 99 && angle > 81) { _animationManager.Play(_animations["Slug down0"]); } else if (angle <= 117 && angle > 99) { _animationManager.Play(_animations["Slug down-22_5"]); } else if (angle <= 135 && angle > 117) { _animationManager.Play(_animations["Slug down-45"]); } else if (angle <= 153 && angle > 135) { _animationManager.Play(_animations["Slug left45"]); } else if (angle <= 171 && angle > 153) { _animationManager.Play(_animations["Slug left22_5"]); } else if (angle <= 189 && angle > 171) { _animationManager.Play(_animations["Slug left0"]); } else if (angle <= 207 && angle > 189) { _animationManager.Play(_animations["Slug left-22_5"]); } else if (angle <= 225 && angle > 207) { _animationManager.Play(_animations["Slug left-45"]); } else if (angle <= 243 && angle > 225) { _animationManager.Play(_animations["Slug up45"]); } else if (angle <= 261 && angle > 243) { _animationManager.Play(_animations["Slug up22_5"]); } else if (angle <= 279 && angle > 261) { _animationManager.Play(_animations["Slug up0"]); } else if (angle <= 297 && angle > 279) { _animationManager.Play(_animations["Slug up-22_5"]); } else if (angle <= 315 && angle > 297) { _animationManager.Play(_animations["Slug up-45"]); } else if (angle <= 333 && angle > 315) { _animationManager.Play(_animations["Slug right45"]); } else if (angle <= 351 && angle > 333) { _animationManager.Play(_animations["Slug right22_5"]); } else { _animationManager.Play(_animations["Slug down0"]); } } }