示例#1
0
    public static Recipe GetItemTypeItem(Enums.enum_item Item_type)
    {
        UnityFunctions.PopulateItemResorces();
        Recipe item = (Recipe)UnityFunctions.resource_data[Item_type.ToString()];

        return(item);
    }
示例#2
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);
    }
示例#3
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);
    }
示例#4
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("");
     }
 }
示例#5
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);
            }
        }
    }