public SpaceshipHealthBar(int level, int health, Mothership.Team team, Spaceship.Rarity rarity) : base("spaceshipHealthBarBackground") { Color teamColor = Color.Transparent; Color rarityColor = Spaceship.colorFor(rarity); switch (team) { case Mothership.Team.red: teamColor = GameColors.redTeam; positionOffset = new Vector2(0.0f, -Spaceship.radius - 8.0f); break; case Mothership.Team.green: case Mothership.Team.blue: teamColor = GameColors.blueTeam; positionOffset = new Vector2(0.0f, Spaceship.radius + 8.0f); break; } fill = new SKSpriteNode(""); fill.color = rarityColor; fill.size = new Vector2(size.X - 4.0f, size.Y - 4.0f); fill.position = new Vector2(-25.5f, 0); fill.anchorPoint = new Vector2(0.0f, 0.5f); addChild(fill); SKSpriteNode border = new SKSpriteNode("spaceshipHealthBarBorder"); addChild(border); SKSpriteNode levelBackground = new SKSpriteNode("spaceshipHealthBarLevelBackground"); levelBackground.position = new Vector2(-38.0f, 0); addChild(levelBackground); labelLevel = new Label($"{level}", 0, 0, HorizontalAlignment.left, VerticalAlignment.top, FontName.kenpixel, FontSize.size8); labelLevel.color = GameColors.fontBlack; levelBackground.addChild(labelLevel); color = teamColor; fill.color = rarityColor; border.color = teamColor; levelBackground.color = teamColor; labelHealth = new Label($"{health}", 0, 0, HorizontalAlignment.left, VerticalAlignment.top, FontName.kenpixel, FontSize.size8); labelHealth.color = GameColors.fontBlack; labelHealth.position = new Vector2(0, 0.5f); addChild(labelHealth); }
public Spaceship(int level, Rarity rarity, bool loadPhysics = false, Mothership.Team team = Mothership.Team.green, Color?color = null) : base("") { this.team = team; this.rarity = rarity; load(level, GameMath.randomBaseDamage(rarity), GameMath.randomBaseLife(rarity), GameMath.randomBaseSpeed(rarity), GameMath.randomBaseRange(rarity), random.Next(skins.Count()), color ?? randomColor(), loadPhysics); }
public Spaceship(SpaceshipData spaceshipData, bool loadPhysics = false, Mothership.Team team = Mothership.Team.green) : base("") { this.team = team; this.spaceshipData = spaceshipData; rarity = (Rarity)spaceshipData.rarity; load(spaceshipData.level, spaceshipData.baseDamage, spaceshipData.baseLife, spaceshipData.baseSpeed, spaceshipData.baseRange, spaceshipData.skin, new Color(spaceshipData.colorRed, spaceshipData.colorGreen, spaceshipData.colorBlue), loadPhysics); }