public Player(GraphicsDeviceManager g, ContentManager c) { graphics = g; content = c; primaryStats = new PStats(); secondaryStats = new SStats(); Initialize(); }
private List <SStats> _GetPointsForPlayer(SPlayer[] results) { var result = new List <SStats>(); for (int i = 0; i < GameData.NumPlayerAtOnce; i++) { var stat = new SStats { ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0 }; result.Add(stat); } result.Sort((s1, s2) => s1.SingPoints.CompareTo(s2.SingPoints)); int current = result[result.Count - 1].SingPoints; int points = result.Count; bool wonset = false; for (int i = result.Count - 1; i >= 0; i--) { SStats res = result[i]; if (i < result.Count - 1) { if (current > res.SingPoints) { res.GamePoints = i * 2; wonset = true; points = res.GamePoints; } else { if (!wonset) { res.Won = 1; } res.GamePoints = points; } } else { res.GamePoints = i * 2; res.Won = 1; } current = res.SingPoints; result[i] = res; } return(result); }
public void Initialize() { LoadContent(); pState = PlayerState.walking; currentDepth = 0; currentSpeed = Game1.screenWidth / 500; playerDimensions = new Vector2(60, 90); startLoc = new Vector2(Game1.screenWidth / 10, (float)(Game1.screenHeight / 1.33)) - playerDimensions / 2; armLoc = startLoc; armLoc.X -= playerDimensions.X / 2; primaryStats = new PStats(); secondaryStats = new SStats(); primaryStats.vitality = 10; primaryStats.strength = 10; primaryStats.dexterity = 10; primaryStats.intelligence = 10; secondaryStats.maxHealth = 20 + primaryStats.vitality * 10; secondaryStats.health = secondaryStats.maxHealth; secondaryStats.maxMana = 20 + primaryStats.intelligence * 10; secondaryStats.mana = secondaryStats.maxMana; currentItem = new Item(graphics, content, 0, startLoc, playerDimensions); secondaryStats.attack = currentItem.CalculateNextAttack(primaryStats.strength, primaryStats.intelligence, primaryStats.dexterity); secondaryStats.atkSpeed = currentItem.CalculateAtkSpd(primaryStats.dexterity); attackNum = 0; maxHealthBarLength = (int)Game1.screenWidth / 5; currentHealthBar = new Rectangle((int)Game1.screenWidth / 20, (int)Game1.screenHeight / 20, (int)Game1.screenWidth / 5, (int)Game1.screenHeight / 20); missingHealthBar = new Rectangle(currentHealthBar.Right, currentHealthBar.Y, 0, currentHealthBar.Height); loc = startLoc; walkAnimation = new SpriteAnimation(8, walkSheet, .45, new Rectangle((int)startLoc.X, (int)startLoc.Y, (int)playerDimensions.X, (int)playerDimensions.Y)); armWalkAnimation = new SpriteAnimation(8, armWalkSheet, .45, new Rectangle((int)armLoc.X, (int)armLoc.Y, (int)(playerDimensions.X * 1.5), (int)playerDimensions.Y)); attackAnimation = new SpriteAnimation(2, attackSheet, secondaryStats.atkSpeed, new Rectangle((int)startLoc.X, (int)startLoc.Y, (int)playerDimensions.X, (int)playerDimensions.Y)); }
public void Initialize(Vector2 position, Vector2 dim, int dept) { healthBarTexture = content.Load <Texture2D>("Textures/WhiteSquare"); dimensions = dim; primaryStats = new PStats(); secondaryStats = new SStats(); secondaryStats.maxHealth = 20; secondaryStats.health = 20; secondaryStats.attack = 15; secondaryStats.atkSpeed = 2; animations = new List <SpriteAnimation>(); loc = position - dimensions / 2; depth = dept; loc.Y += (float)(Game1.screenHeight * (depth * .11)); attackNum = 0; currentHealthBar = new Rectangle((int)loc.X - (int)dimensions.X, (int)loc.Y - (int)dimensions.Y, (int)dimensions.X * 3, (int)dimensions.Y / 2); missingHealthBar = new Rectangle(currentHealthBar.Right, currentHealthBar.Y, 0, currentHealthBar.Height); }
public void Initialize(Vector2 position, Vector2 dim, int dept) { healthBarTexture = content.Load<Texture2D>("Textures/WhiteSquare"); dimensions = dim; primaryStats = new PStats(); secondaryStats = new SStats(); secondaryStats.maxHealth = 20; secondaryStats.health = 20; secondaryStats.attack = 15; secondaryStats.atkSpeed = 2; animations = new List<SpriteAnimation>(); loc = position - dimensions/2; depth = dept; loc.Y += (float)(Game1.screenHeight * (depth * .11)); attackNum = 0; currentHealthBar = new Rectangle((int)loc.X - (int)dimensions.X, (int)loc.Y - (int)dimensions.Y, (int)dimensions.X * 3, (int)dimensions.Y / 2); missingHealthBar = new Rectangle(currentHealthBar.Right, currentHealthBar.Y, 0, currentHealthBar.Height); }
public void Initialize() { LoadContent(); pState = PlayerState.walking; currentDepth = 0; currentSpeed = Game1.screenWidth / 500; playerDimensions = new Vector2(60, 90); startLoc = new Vector2(Game1.screenWidth / 10, (float)(Game1.screenHeight / 1.33)) - playerDimensions / 2; armLoc = startLoc; armLoc.X -= playerDimensions.X / 2; primaryStats = new PStats(); secondaryStats = new SStats(); primaryStats.vitality = 10; primaryStats.strength = 10; primaryStats.dexterity = 10; primaryStats.intelligence = 10; secondaryStats.maxHealth = 20 + primaryStats.vitality * 10; secondaryStats.health = secondaryStats.maxHealth; secondaryStats.maxMana = 20 + primaryStats.intelligence * 10; secondaryStats.mana = secondaryStats.maxMana; currentItem = new Item(graphics, content, 0, startLoc, playerDimensions); secondaryStats.attack = currentItem.CalculateNextAttack(primaryStats.strength, primaryStats.intelligence, primaryStats.dexterity); secondaryStats.atkSpeed = currentItem.CalculateAtkSpd(primaryStats.dexterity); attackNum = 0; maxHealthBarLength = (int)Game1.screenWidth / 5; currentHealthBar = new Rectangle((int)Game1.screenWidth/20, (int)Game1.screenHeight/20, (int)Game1.screenWidth/5, (int)Game1.screenHeight/20); missingHealthBar = new Rectangle(currentHealthBar.Right, currentHealthBar.Y, 0, currentHealthBar.Height); loc = startLoc; walkAnimation = new SpriteAnimation(8, walkSheet, .45, new Rectangle((int)startLoc.X, (int)startLoc.Y, (int)playerDimensions.X, (int)playerDimensions.Y)); armWalkAnimation = new SpriteAnimation(8, armWalkSheet, .45, new Rectangle((int)armLoc.X, (int)armLoc.Y, (int)(playerDimensions.X * 1.5), (int)playerDimensions.Y)); attackAnimation = new SpriteAnimation(2, attackSheet, secondaryStats.atkSpeed, new Rectangle((int)startLoc.X, (int)startLoc.Y, (int)playerDimensions.X, (int)playerDimensions.Y)); }
public void SetSecondaryStats(SStats s) { this._secondaryStats = s; }