Exemplo n.º 1
0
        public static void Register(CustomBlock block)
        {
            Console.WriteLine($"Registering block: {block.GetType()} #{block.BlockID} '{block.Name}'");
            int blockID = block.BlockID;

            CustomBlocks.Add(blockID, block);
            int      hashCode     = ItemTypeInfo.GetHashCode(ObjectTypes.Block, blockID);
            ManSpawn spawnManager = ManSpawn.inst;

            spawnManager.VisibleTypeInfo.SetDescriptor <FactionSubTypes>(hashCode, block.Faction);
            spawnManager.VisibleTypeInfo.SetDescriptor <BlockCategories>(hashCode, block.Category);
            spawnManager.AddBlockToDictionary(block.Prefab);
            RecipeManager.inst.m_BlockPriceLookup.Add(blockID, block.Price);
        }
Exemplo n.º 2
0
        public static void GetBlocksInfos()
        {
            string infos = "";//"ID;Object name;Corp;License Level;Category;Rarity;Buy Price;Mass;Health;Gun Damage;Drill Damage;Hammer Damage;Energy Storage Capacity;Fuel Storage Capacity;Fuel Storage Refill Rate;Energy Consumption Per Sec;Energy Consumed Per Point Healed;Energy Consumed Per Damage Point;Fuel Consumed Per Sec\n";

            foreach (BlockTypes type in Enum.GetValues(typeof(BlockTypes)))
            {
                TankBlock prefab = Singleton.Manager <ManSpawn> .inst.SpawnBlock(type, Vector3.zero, Quaternion.identity);

                if (prefab)
                {
                    int hashCode = ItemTypeInfo.GetHashCode(ObjectTypes.Block, (int)type);

                    infos +=
                        prefab.name + ";" +
                        type.ToString() + ";" +
                        Singleton.Manager <ManSpawn> .inst.VisibleTypeInfo.GetDescriptor <FactionSubTypes>(hashCode).ToString() + ";" +
                        (ManLicenses.inst.GetBlockUnlockTable().GetBlockTier(type, true) + 1) + ";" +
                        prefab.BlockCategory.ToString() + ";" +
                        prefab.BlockRarity.ToString() + ";" +
                        Singleton.Manager <RecipeManager> .inst.GetBlockBuyPrice(type).ToString() + ";" +
                        prefab.CurrentMass.ToString() + ";" +
                        prefab.visible.damageable.Health.ToString();

                    try
                    {
                        infos += ";" + prefab.GetComponentInParent <ModuleWeaponGun>().FiringData.m_BulletPrefab.m_Damage;
                    }
                    catch { infos += ";"; }
                    try
                    {
                        infos += ";" + prefab.GetComponentInParent <ModuleDrill>().damagePerSecond;// +";"+ prefab.GetComponentInParent<ModuleDrill>().impactDamageMultiplier;
                    }
                    catch { infos += ";"; }
                    try
                    {
                        infos += ";" + prefab.GetComponentInParent <ModuleHammer>().impactDamage;
                    }
                    catch { infos += ";"; }
                    try
                    {
                        infos += ";" + prefab.GetComponentInParent <ModuleEnergy>().Store.m_Capacity;
                    }
                    catch { infos += ";"; }
                    try
                    {
                        infos += ";" + prefab.GetComponentInParent <ModuleFuelTank>().Capacity + ";" + prefab.GetComponentInParent <ModuleFuelTank>().RefillRate;
                    }
                    catch { infos += ";"; }
                    try
                    {
                        var shield = prefab.GetComponentInParent <ModuleShieldGenerator>();
                        infos += ";" + shield.m_EnergyConsumptionPerSec + ";" + shield.m_EnergyConsumedPerPointHealed + ";" + shield.m_EnergyConsumedPerDamagePoint;
                    }
                    catch { infos += ";"; }
                    try
                    {
                        infos += ";" + prefab.GetComponentInParent <ModuleBooster>().FuelBurnPerSecond();
                    }
                    catch { infos += ";"; }

                    infos += "\n";
                }
            }
            //infos += "ID;Object name;Corp;License Level;Category;Rarity;Buy Price;Mass;Health;Gun Damage;Drill Damage;Hammer Damage;Energy Storage Capacity;Fuel Storage Capacity;Fuel Storage Refill Rate;Energy Consumption Per Sec;Energy Consumed Per Point Healed;Energy Consumed Per Damage Point;Fuel Consumed Per Sec";
            File.WriteAllText(Path.Combine(FolderStructure.DataFolder, "BlocksInfos.csv"), infos);
        }