Exemplo n.º 1
0
    public static bool GetItemTypeNeedsRefining(Enums.enum_item Item_type)
    {
        UnityFunctions.PopulateItemResorces();
        Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];

        return(item.need_refining);
    }
Exemplo n.º 2
0
    public static Recipe GetItemTypeItem(Enums.enum_item Item_type)
    {
        UnityFunctions.PopulateItemResorces();
        Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];

        return(item);
    }
Exemplo n.º 3
0
    private IEnumerator FireConinuous()
    {
        while (true)
        {
            SingleUpdateUsage();
            if (wepon_type == Enums.enum_wepon_type.double_blaster || wepon_type == Enums.enum_wepon_type.single_blaster)
            {
                foreach (GameObject fp in this.fire_points)
                {
                    UnityFunctions.FireProjectile(prefab_blaster_laser, fp, this.order_layer - 1, projectile_speed + rb.velocity.magnitude, projectile_damage);
                }
            }
            else if (wepon_type == Enums.enum_wepon_type.rotary)
            {
                if (target.target_object != null)
                {
                    foreach (GameObject fp in this.fire_points)
                    {
                        UnityFunctions.FireProjectile(prefab_blaster_laser, fp, this.order_layer - 1, projectile_speed + rb.velocity.magnitude, projectile_damage);
                    }
                }
            }

            if (laserAudio != null)
            {
                AudioSource.PlayClipAtPoint(laserAudio, new Vector3(0, 0, 0));
            }
            yield return(new WaitForSeconds(projectileFiringPeriod));

            if (this.is_in_storage == true)
            {
                break;
            }
        }
    }
Exemplo n.º 4
0
    private void Update()
    {
        if (!this.is_in_storage)
        {
            if (is_in_storage == true)
            {
                return;
            }
            if (this.Is_Malfunctioning() && this.is_online && this.active)
            {
                if (target != null)
                {
                    //Left make the trurret target
                    target.range = this.Get_Calculated_Range();

                    target.TargetingRange(transform.position);
                    if (target.target_object != null)
                    {
                        UnityFunctions.LookAt2D(transform, target.target_object.transform, rotate_speed, Enums.enum_facing_direction.Up);
                    }
                }
                if (wepon_type == Enums.enum_wepon_type.beam)
                {
                    Fire_Beam();
                }
                else
                {
                    Fire_Blaster();
                }
            }
            UpdateUsage();
        }
    }
Exemplo n.º 5
0
    public static string GetItemTypeResorceLocation(Enums.enum_item Item_type)
    {
        UnityFunctions.PopulateItemResorces();
        Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];

        return(item.prefab_path);
    }
Exemplo n.º 6
0
 private IEnumerator FireConinuous()
 {
     while (true)
     {
         UnityFunctions.FireProjectile(prefab_blaster_laser, fire_point1, 100, fire_speed, damage);
         yield return(new WaitForSeconds(1));
     }
 }
Exemplo n.º 7
0
 private void ProcessHit(DamageDealer damageDealer)
 {
     current_health -= damageDealer.GetDamage();
     UnityFunctions.CameraShake();
     damageDealer.Hit();
     if (current_health <= 0)
     {
         current_health = 0;
     }
     this.SendAlert(enum_status.Danger, this.name + " is taking Damage!");
 }
Exemplo n.º 8
0
 private void Populate_Mount_Point_Drop_Panels()
 {
     ModuleSystemInfo[] modules = UnityFunctions.GetModules();
     foreach (ModuleSystemInfo module in modules)
     {
         GameObject item = Instantiate(inventory_item, inventory_panel.transform);
         item.transform.parent = mount_point_drop_zone_list[module.mount_point].transform;
         InventoryItem inv = item.GetComponent <InventoryItem>();
         inv.SetItem(module.gameObject);
     }
 }
Exemplo n.º 9
0
    public void LoadData(UpgradeItem selected_item)
    {
        gameObject.SetActive(true);

        this.selected_item = selected_item;
        //**********************
        //Get the ship Managment
        //**********************
        GameObject player = GameObject.Find("Player_Config");

        if (player == null)
        {
            return;
        }
        ShipManagment ship_managment = player.GetComponent <ShipManagment>();

        if (ship_managment == null)
        {
            return;
        }

        //***********************************
        //Lets get the drop panel of the item
        //***********************************
        Transform panel = gameObject.transform.Find("DropPanel");

        if (panel != null)
        {
            //*************************
            //Lest remove all old items
            //*************************
            foreach (Transform child in panel.transform)
            {
                GameObject.Destroy(child.gameObject);
            }
            if (invetory_upgrade_item_prrefab == null)
            {
                return;
            }
            foreach (Upgrade_Settings e in ship_managment.stored_upgrades)
            {
                GameObject  button = Instantiate(invetory_upgrade_item_prrefab, panel);
                UpgradeItem item   = button.GetComponent <UpgradeItem>();
                if (item != null)
                {
                    item.SetItem(e);
                }
                EventTrigger trigger = item.GetComponent <EventTrigger>();
                UnityFunctions.AddListener(ref trigger, EventTriggerType.PointerClick, onClickListener);
            }
        }
    }
Exemplo n.º 10
0
 public static string GetItemTypeDescription(Enums.enum_item Item_type)
 {
     UnityFunctions.PopulateItemResorces();
     if (UnityFunctions.resource_data.Contains(Item_type.ToString()))
     {
         Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];
         return(item.description);
     }
     else
     {
         return("");
     }
 }
Exemplo n.º 11
0
    private IEnumerator RepairItem()
    {
        while (true)
        {
            this.repair_ammount      = this.settings.Action_speed;
            this.time_between_repair = this.settings.Action_speed2;
            this.max_repair          = this.settings.Ammount;

            if (this.is_online && this.active)
            {
                if (current_item == null)
                {
                    float smallest_health = 999999;
                    //find somthing that needs repairing
                    ModuleSystemInfo[] items = GeEquipedItems();
                    foreach (ModuleSystemInfo i in items)
                    {
                        if (i.Is_Destroyed() == false && i.current_health < smallest_health && i.current_health < this.max_repair)
                        {
                            current_item    = i;
                            smallest_health = i.current_health;
                        }
                    }
                    if (current_item != null)
                    {
                        StartUsage();
                        UnityFunctions.SendAlert(Enums.enum_status.Info, "Repairing " + current_item.name);
                    }
                }
                else
                {
                    if (current_item.current_health >= this.max_repair)
                    {
                        UnityFunctions.SendAlert(Enums.enum_status.Info, current_item.name + " Repaired ");
                        current_item = null;
                    }
                    else
                    {
                        current_item.current_health += repair_ammount;
                        if (current_item.current_health > this.max_repair)
                        {
                            current_item.current_health = this.max_repair;
                            current_item = null;
                            StopUsage();
                        }
                    }
                }
            }
            yield return(new WaitForSeconds(time_between_repair));
        }
    }
Exemplo n.º 12
0
    public void DamageShield(float damage_f = 0)
    {
        Rigidbody2D rb = GetComponentInParent <Rigidbody2D>();

        if (damage_f > 0)
        {
            this.current_shield -= damage_f * total_upgrade_damage_resistance;
        }
        else
        {
            float kernetic_energy1 = UnityFunctions.Calc_Kinetic_Energy(rb);
            this.current_shield -= (kernetic_energy1 * 0.05f) * total_upgrade_damage_resistance;
        }
    }
Exemplo n.º 13
0
    private IEnumerator ProcessBin()
    {
        processing = true;
        do
        {
            if (this.is_online && this.active)
            {
                Recipe item      = processing_bin[0];
                bool   validated = true;
                foreach (Recipe.Ingreadient i in item.ingredients)
                {
                    int in_stock = storage.Inventory_Item_Count(i.item_type);
                    if (in_stock < i.qty)
                    {
                        validated = false; break;
                    }
                }
                if (validated == true)
                {
                    process_time    = item.make_time;
                    current_item    = item.item_type;
                    est_finish_time = new DateTimeOffset(DateTime.Now.AddSeconds(process_time));
                    yield return(new WaitForSeconds(process_time));

                    Recipe id = UnityFunctions.GetItemTypeItem(item.item_type);
                    if (storage != null)
                    {
                        if (id.resorce_type == Enums.enum_resorce_type.material)
                        {
                            //First check we have all the  items

                            //************************************
                            //We need to remove x items from stock
                            //************************************
                            foreach (Recipe.Ingreadient i in item.ingredients)
                            {
                                storage.remove_x_material(i.item_type, i.qty);
                            }
                            storage.Store_Material(item.item_type);
                        }
                    }
                }
                processing_bin.RemoveAt(0);
            }
        } while (processing_bin.Count > 0);
        processing = false;
        StopUsage();
    }
Exemplo n.º 14
0
 public void Generatematerials(Vector2 hitpoint)
 {
     if (available_item_count > 0)
     {
         available_item_count -= 1;
         GameObject item     = items[Random.Range(0, items.Count - 1)];
         GameObject material = Instantiate(item, hitpoint, Quaternion.identity) as GameObject;
         Rotator    R        = material.GetComponent <Rotator>();
         if (R != null)
         {
             R.Set_rotation_Speed(Random.Range(-item_rotate_speed_min, item_rotate_speed_max));
         }
         UnityFunctions.Move_RB_Random(material.GetComponent <Rigidbody2D>(), item_move_speed_min, item_move_speed_max);
         if (time_to_live > 0)
         {
             Destroy(material, time_to_live);
         }
     }
 }
Exemplo n.º 15
0
 // Update is called once per frame
 private void Update()
 {
     TargetingRange(transform.position, fire_range);
     if (target_object != null)
     {
         UnityFunctions.LookAt2D(transform, target_object.transform, 2f, Enums.enum_facing_direction.Up);
         if (fireing == null)
         {
             fireing = StartCoroutine(FireConinuous());
         }
     }
     else
     {
         if (fireing != null)
         {
             StopCoroutine(fireing);
         }
     }
 }
Exemplo n.º 16
0
 public void Build_Inventory_List_Items()
 {
     //******************************
     //Clear the invetory panel first
     //******************************
     ClearInvetoryPanel();
     //*************************
     //Load stored Items in list
     //*************************
     ModuleSystemInfo[] modules = UnityFunctions.GetStoredModules();
     foreach (ModuleSystemInfo module in modules)
     {
         GameObject item = Instantiate(inventory_item.gameObject, inventory_panel.transform);
         //Lets config it
         InventoryItem inv = item.GetComponent <InventoryItem>();
         inv.SetItem(module.gameObject);
         item.transform.parent = inventory_panel.transform;
     }
 }
Exemplo n.º 17
0
 public void SetToggleNameAndValue(string Name, bool val, float health, bool is_malfunctioning = false)
 {
     toggle.isOn = val;
     label.text  = Name.Replace("(Clone)", "") + " " + health.ToString() + "%";
     if (health > 0)
     {
         if (is_malfunctioning == true)
         {
             label.color = UnityFunctions.Color_Green();
         }
         else
         {
             label.color = UnityFunctions.Color_Orange();
         }
     }
     else
     {
         label.color = UnityFunctions.Color_Green();
     }
 }
Exemplo n.º 18
0
    public void SetScreenNoCommandModule()
    {
        //***********************************
        //First we need to remove all modules
        //***********************************
        ModuleSystemInfo[] modules = UnityFunctions.GetModules();
        foreach (ModuleSystemInfo module in modules)
        {
            this.Store_Module(module.gameObject);
        }

        Build_Inventory_List_Items();

        //********************************
        //We need to remove all drop zones
        //********************************
        foreach (GameObject p in this.mount_point_panels)
        {
            p.SetActive(false);
            int childs = p.transform.childCount;
            for (int i = childs - 1; i >= 0; i--)
            {
                GameObject.DestroyImmediate(p.transform.GetChild(i).gameObject);
            }
        }
        //**********************************************
        //Create a panel to handle adding command module
        //**********************************************
        if (!this.tmp_drop_panel)
        {
            this.mount_point_panels[0].SetActive(true);
            this.tmp_drop_panel = Instantiate(mount_point_drop_zone, this.mount_point_panels[0].transform);
            Populate_Mount_Point_Drop_Panels();
        }
        this.drop_panels_loaded = false;
        //*******************
        //Disable all buttons
        //*******************
        DisableEnableButtons(false);//Disble all the button
    }
Exemplo n.º 19
0
    public void DamageShip(float damage_f = 0)
    {
        Rigidbody2D rb = GetComponentInParent <Rigidbody2D>();

        if (damage_f > 0)
        {
            //************************
            //Shake camera if dieectly
            //************************
            UnityFunctions.CameraShake();
            this.current_health -= damage_f * total_upgrade_damage_resistance;
        }
        else
        {
            float kernetic_energy1 = UnityFunctions.Calc_Kinetic_Energy(rb);
            //*****************************************
            //Shake camera if we are hit by a explosion
            //*****************************************
            UnityFunctions.CameraShake(0.2f, (kernetic_energy1 * 0.05f));
            this.current_health -= (kernetic_energy1 * 0.05f) * total_upgrade_damage_resistance;
        }
        this.SendAlert(enum_status.Danger, this.name + " is taking Damage!");
    }
Exemplo n.º 20
0
    public void Activate(float overthrust = -1)
    {
        if (Is_Malfunctioning() && this.is_online && this.active)
        {
            //if (overthrust < current_Thrust && this.IsInUse()) { return; }


            if (overthrust > -1)
            {
                current_thrust = overthrust;
            }
            if (current_thrust > settings.Thrust_start)
            {
                current_thrust = settings.Thrust_start;
            }
            fx = GetComponent <ParticleSystem>();
            fx.Play();

            ParticleSystem.ShapeModule shape = fx.shape;
            if (player_obj != null)
            {
                shape.scale = player_obj.transform.localScale;
            }

            ParticleSystem.MainModule s = fx.main;
            s.startLifetime = UnityFunctions.normValue(current_thrust + 20, 0, settings.Thrust_start);

            StartUsage();

            if (player_rb == null)
            {
                return;
            }

            UnityFunctions.Trust_At_Point(player_rb, transform, current_thrust);
        }
    }
Exemplo n.º 21
0
 private void Awake()
 {
     LoadPlayer();
     UnityFunctions.PopulateCommonVariables();
 }
Exemplo n.º 22
0
    public void OnDrop(PointerEventData eventData)
    {
        ItemDragHandler  d              = eventData.pointerDrag.GetComponent <ItemDragHandler>();
        InventoryItem    inv_item       = eventData.pointerDrag.gameObject.GetComponent <InventoryItem>();
        EnabledDisabled  enable_disable = gameObject.GetComponentInParent <EnabledDisabled>();
        ModuleSystemInfo sys_info       = inv_item.item.GetComponent <ModuleSystemInfo>();

        if (sys_info.allow_multiple_install == false && inventory_box == Enums.emun_inventory.Selected)
        {
            if (UnityFunctions.ModuleInstalled(inv_item.item_type))
            {
                return;
            }
        }

        //*****************************************************
        //Couple of test to make sure we can drop the item here
        //*****************************************************
        if (enable_disable != null)
        {
            if (enable_disable.Is_Enabled == false)
            {
                return;
            }
        }
        if (inv_item != null)
        {
            if (inv_item.is_disabled)
            {
                d.parentToReturnTo = this.transform; return;
            }
        }

        if (d != null)
        {
            if (enforce_max == true)
            {
                InventoryItem[] i = GetComponentsInChildren <InventoryItem>();
                if (i != null)
                {
                    if (i.Length + 1 > max_items)
                    {
                        return;
                    }
                }
            }

            if (inventory_box == Enums.emun_inventory.Selected)
            {
                MountPoint mp = GetComponentInParent <MountPoint>();
                if (mp != null)
                {
                    if (inv_item.is_command_module)
                    {
                        storage.Equip(inv_item.item);
                        storage.Build_Mount_Point_Drop_Panels();
                    }
                    else
                    {
                        MountPoint amp = mp.associated_mountpoint.GetComponent <MountPoint>();
                        sys_info.mount_point = amp.index;
                        storage.Equip(inv_item.item);
                    }
                }
            }
            else
            {
                storage.Store_Module(inv_item.item);

                if (sys_info.is_command_module)
                {
                    Destroy(eventData.pointerDrag.gameObject);
                    storage.SetScreenNoCommandModule();
                }
            }

            d.parentToReturnTo = this.transform;
        }
    }
Exemplo n.º 23
0
 public bool GetNeedsRefining()
 {
     return(UnityFunctions.GetItemTypeNeedsRefining(Item_type));
 }
Exemplo n.º 24
0
 public static Color Color_Orange()
 {
     return(UnityFunctions.RGBA(255, 150, 0, 255));
 }
Exemplo n.º 25
0
 public static Color Color_Green()
 {
     return(UnityFunctions.RGBA(45, 195, 52, 255));
 }
Exemplo n.º 26
0
    private void UpdateValues()
    {
        heat          = 0;
        battery_drain = 0;
        fuel_drain    = 0;
        mass          = 0;
        this.shield   = 0;
        int heat_generating_module = 0;

        //****************************************
        //Loop through each module and gather data
        //****************************************
        foreach (ModuleSystemInfo ms in UnityFunctions.GetModules())
        {
            if (ms != null)
            {
                if (ms.is_in_storage == false)
                {
                    //**************
                    //heat
                    //**************
                    heat += ms.current_heat;
                    if (ms.Generates_Heat())
                    {
                        heat_generating_module += 1;
                    }

                    //*******************
                    //Power
                    //*******************
                    if (ms.current_power > 0)
                    {
                    }
                    battery_drain += ms.current_power;

                    //******
                    //Fuel
                    //******
                    fuel_drain += ms.current_fuel;

                    //*******
                    //Mass
                    //*******
                    mass += ms.Get_Calculated_Mass();

                    //Shield
                    shield += ms.current_shield;

                    ms.ResetUsage();
                }
            }
        }

        //******
        //Heat
        //******
        if (heat < 0)
        {
            heat = 0;
        }
        heat_max = (heat_generating_module * 100);

        //*******
        //Battery
        //*******
        battery += battery_drain;
        upgraded_battery_max = total_upgrade_battery_max * battery_max;
        battery = Mathf.Clamp(battery, 0, upgraded_battery_max);

        //*******
        //Fuel
        //*******
        fuel += fuel_drain;
        upgraded_fuel_max = total_upgrade_fuel_max * fuel_max;
        fuel = Mathf.Clamp(fuel, 0, upgraded_fuel_max);

        //*******
        //Mass
        //*******
        if (rb != null)
        {
            rb.mass = mass;
        }

        //******
        //health
        //******
        this.health_max = command_mod_system_info.settings.Health_start;
        this.health     = command_mod_system_info.current_health;



        //******************************************
        //This feeds back information to each module
        //******************************************
        foreach (ModuleSystemInfo ms in UnityFunctions.GetModules())
        {
            if (ms != null)
            {
                ms.Set_Values(heat, heat_max, battery, upgraded_battery_max, fuel, fuel_max);
            }
        }
    }
Exemplo n.º 27
0
    private void CalcUpgrades()
    {
        //************************
        //Run once to calc modules
        //************************
        total_upgrade_battery_max = 1;
        total_upgrade_fuel_max    = 1;
        total_upgrade_shield_max  = 1;
        total_upgrade_cpu         = 0;
        cpu_usage = 0;
        cpu_max   = 0;

        //This will cal the upgrades values
        foreach (ModuleSystemInfo ms in UnityFunctions.GetModules())
        {
            if (ms != null)
            {
                if (ms.is_in_storage == false)
                {
                    //*********************************
                    //Calc the module internal upgrades
                    //*********************************
                    //ms.CalcUpgrades();

                    /* if (shield_obj == null) {
                     *   if(ms.GetComponent<ItemResorce>().Item_type== Enums.enum_item.module_shield) {
                     *       this.shield_obj = (Shield)ms;
                     *   }
                     * }*/
                    //**************
                    //heat
                    //**************
                    //************
                    //CPU
                    //************
                    float cpu = ms.Get_Calculated_CPU_V();
                    if (cpu > 0)
                    {
                        cpu_max += cpu;
                    }
                    else
                    {
                        cpu_usage += Mathf.Abs(cpu);
                    }

                    //*******************
                    //Power
                    //*******************
                    total_upgrade_battery_max += ms.Get_Calculated_Extra_Battery_Capacity_P();

                    //******
                    //Fuel
                    //******
                    total_upgrade_fuel_max += ms.Get_Calculated_Extra_Fuel_Capacity_P();

                    fuel_drain += ms.current_fuel;

                    //*******
                    //shield
                    //*******
                    shield_max += ms.Get_Calculated_Max_Shield_Capacity();
                }
            }
        }
    }
Exemplo n.º 28
0
 public Recipe GetItem()
 {
     return(UnityFunctions.GetItemTypeItem(Item_type));
 }
Exemplo n.º 29
0
    public GameObject Create_Module(ModuleSaveModel model)
    {
        //GameObject refab = Resources.Load(model.module_name.ToString()) as GameObject;
        Recipe r = UnityFunctions.GetItemTypeItem(model.item_type);

        if (r.preFab != null)
        {
            GameObject modules        = GameObject.Find("Modules");
            GameObject stored_modules = GameObject.Find("Stored_Modules");
            ShipModule sm             = modules.GetComponentInChildren <ShipModule>();

            GameObject obj_module = null;

            if (sm == null)
            {
                //Debug.Log("Loading Model");
                obj_module = Instantiate(r.preFab, gameObject.transform.position, gameObject.transform.rotation) as GameObject;
                sm         = obj_module.GetComponent <ShipModule>();
                if (sm != null)
                {
                    sm.LoadMountPoints();
                }
            }
            else
            {
                if (model.is_internal_module == false)
                {
                    MountPoint mp = null;
                    if (model.is_in_storage == false)
                    {
                        mp = sm.mount_points[0];
                    }
                    else
                    {
                        mp = sm.mount_points[model.mount_point - 1];
                    }

                    if (mp != null)
                    {
                        obj_module = Instantiate(r.preFab, mp.transform.position, mp.transform.rotation) as GameObject;
                    }
                }
                else
                {
                    obj_module = Instantiate(r.preFab, stored_modules.transform) as GameObject;
                }
            }

            //Need to add the keybindings
            if (obj_module == null)
            {
                return(null);
            }
            ModuleSystemInfo mod_sys = obj_module.GetComponent <ModuleSystemInfo>();
            ItemResorce      ir      = obj_module.GetComponent <ItemResorce>();
            //mod_sys.key_mappings = model.key_mappings;
            //mod_sys.id = model.id;
            mod_sys.current_health     = model.health;
            mod_sys.mount_point        = model.mount_point;
            mod_sys.order_layer        = model.order_layer;
            mod_sys.is_internal_module = model.is_internal_module;
            mod_sys.active             = model.enabled;
            mod_sys.upgrades.Clear();
            //Load upgrades
            foreach (string s in model.upgrades)
            {
                Upgrade_Settings upgrade = Resources.Load(s) as Upgrade_Settings;
                mod_sys.upgrades.Add(upgrade);
            }
            return(obj_module);
        }
        else
        {
            return(null);
        }
    }
Exemplo n.º 30
0
    public void LoadPlayer()
    {
        UnityFunctions.PopulateItemResorces();

        PlayerSaveModel player_model   = PlayerSaveModel.LoadPlayer();
        ShipManagment   ship_mamanmger = gameObject.GetComponent <ShipManagment>();

        ship_mamanmger.fuel    = player_model.fuel;
        ship_mamanmger.battery = player_model.battery;

        if (is_config == false)
        {
            transform.position = player_model.position;
            transform.rotation = player_model.roation;
        }
        else
        {
            stored_pos      = player_model.position;
            stored_rotation = player_model.roation;
        }

        //*************
        //Load invetory
        //*************
        InventoryManager inv = gameObject.GetComponent <InventoryManager>();

        inv.inventory.Clear();
        if (inv != null && player_model.inventory != null)
        {
            foreach (Enums.enum_item e in player_model.inventory)
            {
                //if (UnityFunctions.GetItemTypeResorceType(e) == Enums.enum_resorce_type.blueprint) {
                //inv.blueprints.Add(new InventoryManager.Item(e));
                //} else {
                inv.inventory.Add(new InventoryManager.Item(e));
                // }
            }
        }

        //****************
        //Load blue prints
        //****************
        //inv.blueprints.Clear();
        if (inv != null && player_model.blueprints != null)
        {
            foreach (Enums.enum_item e in player_model.blueprints)
            {
                inv.blueprints.Add(new InventoryManager.Item(e));
            }
        }


        //*****************
        //Load the upgrades
        //*****************
        ship_mamanmger.stored_upgrades.Clear();
        foreach (string e in player_model.stored_upgrades)
        {
            Upgrade_Settings refab = Resources.Load(e) as Upgrade_Settings;
            ship_mamanmger.stored_upgrades.Add(refab);
        }

        //********************************************
        //Loop through the modules in our player model
        //********************************************
        foreach (ModuleSaveModel module in player_model.modules)
        {
            //****************
            //Create our modue
            //****************
            GameObject new_module = Create_Module(module);
            if (new_module != null)
            {
                //************
                //Add upgrades
                //************
                ship_mamanmger.Equip(new_module);
            }
        }

        //********************************************
        //Loop through the modules in our player model
        //********************************************

        foreach (ModuleSaveModel module in player_model.stored_modules)
        {
            //****************
            //Create our modue
            //****************
            GameObject new_module = null;
            try {
                new_module = Create_Module(module);
            } catch (Exception ex) {
                Debug.Log(ex);
            }
            if (new_module != null)
            {
                ship_mamanmger.Store_Module(new_module);
            }
        }
    }