예제 #1
0
        internal static PlayerData newPlayerData(this MemoryCard memoryCard)
        {
            PlayerData playerData = memoryCard.insert <PlayerData>();

            playerData.botLevel          = 0;
            playerData.deviceName        = "deviceName";
            playerData.maxBotLevel       = 0;
            playerData.maxBotRarity      = 0;
            playerData.maxSpaceshipLevel = 10;
            playerData.modelVersion      = 0;
            playerData.music             = true;
            playerData.name          = "name";
            playerData.points        = 10000;
            playerData.premiumPoints = 256;
            playerData.sound         = true;

            MothershipData mothershipData = memoryCard.newMothershipData();

            playerData.mothership = mothershipData;

            Element.Type[] elementTypes =
            {
                Element.Type.water,
                Element.Type.fire,
                Element.Type.ice,
                Element.Type.wind
            };

            for (int i = 0; i < 4; i++)
            {
                MothershipSlotData mothershipSlotData = memoryCard.newMothershipSlotData();
                mothershipSlotData.index = i;

                SpaceshipData spaceshipData = memoryCard.newSpaceshipData(Spaceship.Rarity.common,
                                                                          Spaceship.randomColorFor(elementTypes[i]));
                mothershipSlotData.spaceship = spaceshipData;
                mothershipData.addToSlots(mothershipSlotData);
            }

            return(playerData);
        }
예제 #2
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);
        }
예제 #3
0
 internal void addToSpaceships(SpaceshipData spaceshipData)
 {
     spaceshipData.parentPlayer = this;
 }