Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        internal static int randomBaseDamage(Spaceship.Rarity rarity)
        {
            double min = 0.9;
            double max = 1.1;

            double x = min + SKNode.random.NextDouble() * (max - min);

            switch (rarity)
            {
            case Spaceship.Rarity.common:
                x = x * 11;
                break;

            case Spaceship.Rarity.uncommon:
                x = x * 16;
                break;

            case Spaceship.Rarity.rare:
                x = x * 23;
                break;

            case Spaceship.Rarity.heroic:
                x = x * 34;
                break;

            case Spaceship.Rarity.epic:
                x = x * 50;
                break;

            case Spaceship.Rarity.legendary:
                x = x * 73;
                break;

            case Spaceship.Rarity.supreme:
                x = x * 107;
                break;
            }

            return((int)Math.Round(x));
        }
Exemplo n.º 3
0
        internal static SpaceshipData newSpaceshipData(this MemoryCard memoryCard, Spaceship.Rarity rarity, Color?color = null)
        {
            SpaceshipData spaceshipData = memoryCard.insert <SpaceshipData>();

            if (color == null)
            {
                color = Spaceship.randomColor();
            }

            spaceshipData.colorRed   = color.Value.R / 255.0f;
            spaceshipData.colorGreen = color.Value.G / 255.0f;
            spaceshipData.colorBlue  = color.Value.B / 255.0f;
            spaceshipData.baseDamage = GameMath.randomBaseDamage(rarity);
            spaceshipData.level      = 1;
            spaceshipData.baseLife   = GameMath.randomBaseLife(rarity);
            spaceshipData.baseRange  = GameMath.randomBaseRange(rarity);
            spaceshipData.baseSpeed  = GameMath.randomBaseSpeed(rarity);
            spaceshipData.rarity     = rarity.GetHashCode();

            spaceshipData.skin = SKNode.random.Next(Spaceship.skins.Count());
            spaceshipData.xp   = 0;

            return(spaceshipData);
        }
Exemplo n.º 4
0
        internal static int unlockSpaceshipPriceInPremiumPoints(Spaceship.Rarity rarity)
        {
            double price = 12.5 / 2.0 * Math.Pow(2.0, (double)rarity);

            return((int)price);
        }
Exemplo n.º 5
0
        internal static int buySpaceshipPriceInPoints(Spaceship.Rarity rarity)
        {
            double price = 62500.0 * Math.Pow(2.0, (double)rarity);

            return((int)price);
        }