Esempio n. 1
0
    void PrintSOs()
    {
        string printString = "ScriptableObjects:\n--ContainerFillers--\n";

        ContainerFiller[] toListi = ContainerFiller.GetAll();
        foreach (ContainerFiller s in toListi)
        {
            printString += s.GetDebugString() + "\n";
        }

        printString += "--Effects--\n";
        SOEffect[] toListe = SOEffect.GetAll();
        foreach (SOEffect s in toListe)
        {
            printString += s.GetDebugString() + "\n";
        }

        printString += "--Items--\n";
        SOItem[] toListit = SOItem.GetAll();
        foreach (SOItem s in toListit)
        {
            printString += s.GetDebugString() + "\n";
        }

        printString += "--Recipes--\n";
        SORecipe[] toListre = SORecipe.GetAll();
        foreach (SORecipe s in toListre)
        {
            printString += s.GetDebugString() + "\n";
        }
        printString += "End of ScriptableObjects";

        Debug.Log(printString);
    }
Esempio n. 2
0
        private bool DeleteItems()
        {
            bool   boRetValue = false;
            string stIDs      = "";

            foreach (DataListItem item in lstItem.Items)
            {
                HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList");
                if (chkList != null)
                {
                    if (chkList.Checked == true)
                    {
                        stIDs     += chkList.Value + ",";
                        boRetValue = true;
                    }
                }
            }
            if (boRetValue)
            {
                SOItem clsSOItem = new SOItem();
                clsSOItem.Delete(stIDs.Substring(0, stIDs.Length - 1));

                SO clsSO = new SO(clsSOItem.Connection, clsSOItem.Transaction);
                clsSO.SynchronizeAmount(Convert.ToInt64(lblSOID.Text));

                SODetails clsSODetails = clsSO.Details(Convert.ToInt64(lblSOID.Text));

                clsSOItem.CommitAndDispose();

                UpdateFooter(clsSODetails);
            }

            return(boRetValue);
        }
Esempio n. 3
0
 public void AddItem(SOItem item)
 {
     lastInvSize = inv.Count;
     inv.Add(item);
     Game.current.DisplayItemBox(item);
     Game.current.UpdateHUD();
 }
Esempio n. 4
0
 public void GiveItemOnce(SOItem item)
 {
     if (!gaveItem)
     {
         gaveItem = true;
         Player.current.AddItem(item);
     }
 }
    /*
     * public void CheckItemType (SOItem ItemToCheck)
     * {
     *  if (ItemToCheck.itemType == ItemType.Weapon)
     *  {
     *      PlayerWeapon = ItemToCheck;
     *  }
     *  else
     *  {
     *      PlayerArmor = ItemToCheck;
     *  }
     * }
     */

    private void GenerateStartingItems()
    {
        SOItem Weapon = ScriptableObject.Instantiate(Pool.pool.AllWeaponsPrefabs[Random.Range(0, Pool.pool.AllWeaponsPrefabs.Count)]);
        SOItem armor  = ScriptableObject.Instantiate(Pool.pool.AllArmorsPrefabs[Random.Range(0, Pool.pool.AllArmorsPrefabs.Count)]);

        Pool.pool.WeaponOnPlayer = Weapon;
        Pool.pool.ArmorOnPlayer  = armor;
    }
Esempio n. 6
0
        private void LoadItems()
        {
            SOItem clsSOItem = new SOItem();

            lstItem.DataSource = clsSOItem.ListAsDataTable(Convert.ToInt64(lblSOID.Text)).DefaultView;
            lstItem.DataBind();
            clsSOItem.CommitAndDispose();
        }
Esempio n. 7
0
    private void Battle()
    {
        _playerWeapon = Pool.pool.WeaponOnPlayer;
        _playerArmor  = Pool.pool.ArmorOnPlayer;
        _enemy        = Pool.pool.EnemyInBattle;

        _shouldBattle = true;
    }
    public void ChoosingItem(SOEnemy defeatedEnemy)
    {
        _itemIndex = Random.Range(0, ItemsAbleToGet.Length);

        SOItem newItem = ScriptableObject.Instantiate(ItemsAbleToGet[_itemIndex]) as SOItem;

        inventory.AddItemInInventory(newItem);
    }
Esempio n. 9
0
        private void SetDataSource(ReportDocument Report)
        {
            long iID = 0;

            try
            {
                if (Request.QueryString["task"].ToString().ToLower() == "reportfromposted" && Request.QueryString["soid"].ToString() != null)
                {
                    iID = Convert.ToInt64(Request.QueryString["soid"].ToString());
                }
                else
                {
                    iID = Convert.ToInt64(Common.Decrypt(Request.QueryString["soid"].ToString(), Session.SessionID));
                }
                lblReferrer.ToolTip = iID.ToString();
            }
            catch { iID = long.Parse(lblReferrer.ToolTip); }

            ReportDataset rptds = new ReportDataset();

            SO clsSO = new SO();
            MySqlDataReader myreader = clsSO.List(iID, "SOID", SortOption.Ascending);

            while (myreader.Read())
            {
                DataRow drNew = rptds.SO.NewRow();

                foreach (DataColumn dc in rptds.SO.Columns)
                {
                    drNew[dc] = "" + myreader[dc.ColumnName];
                }

                rptds.SO.Rows.Add(drNew);
            }
            myreader.Close();

            SOItem clsSOItem = new SOItem(clsSO.Connection, clsSO.Transaction);

            System.Data.DataTable dt = clsSOItem.ListAsDataTable(iID);
            foreach (System.Data.DataRow dr in dt.Rows)
            {
                DataRow drNew = rptds.SOItems.NewRow();

                foreach (DataColumn dc in rptds.SOItems.Columns)
                {
                    drNew[dc] = "" + dr[dc.ColumnName];
                }

                rptds.SOItems.Rows.Add(drNew);
            }
            clsSO.CommitAndDispose();

            Report.SetDataSource(rptds);
            SetParameters(Report);
        }
Esempio n. 10
0
    public bool UseItem(SOItem item)
    {
        if (inv.Contains(item))
        {
            inv.Remove(item);
            Game.current.UpdateHUD();
            return(true);
        }

        return(false);
    }
    public void UpgradeItem(SOItem ItemOnPlayerToUpgrade)
    {
        ChangeNumberOfGold(-ItemOnPlayerToUpgrade.UpgradeCost);
        if (_goldTransactionIsValid)
        {
            ItemOnPlayerToUpgrade.Level++;
            ////ItemLevel++; dali onda tu mjenjamo Item level ili u SOItem?

            //mora bit weapon
            levelScaling.UpgradeWeapon(ItemOnPlayerToUpgrade);
        }
    }
Esempio n. 12
0
    public void RemoveItemFromInventory(SOItem ItemToRemove)
    {
        ItemsInInventory.Remove(ItemToRemove);
        OnInventoryChanged.Invoke(this);

        for (int i = 0; i < ItemsInInventory.Count; i++)
        {
            if (ItemsInInventory[i] == ItemToRemove)
            {
                ItemsInInventory[i] = null;
            }
        }
    }
Esempio n. 13
0
        void Buy(int id)
        {
            Item   item   = holder.Items[id];
            SOItem SOItem = holder.GetItem(id);
            Cell   cell   = L_Cells[id].GetComponent <Cell>();

            Debug.Log("Buy- " + id);
            if (GC.Data.Money >= SOItem.Price)
            {
                cell.Buy();
                item.IsBuy     = true;
                GC.Data.Money -= SOItem.Price;
            }
        }
Esempio n. 14
0
 public void AddItemInInventory(SOItem ItemToAdd)
 {
     {
         if (ItemsInInventory.Count < Size)
         {
             ItemsInInventory.Add(ItemToAdd);
             OnInventoryChanged.Invoke(this);
         }
         else
         {
             Debug.Log("Inventory is full");
         }
     }
 }
    public void GenerateLootItems()
    {
        SOItem Item = ScriptableObject.Instantiate(Pool.pool.AllItemsPrefabs[Random.Range(0, Pool.pool.AllItemsPrefabs.Count)]);

        Item.Level = Random.Range(0, Item.MaxLevel);

        if (NumOfEnemies == 0)
        {
            SwitchedPhase(GameplayPhase.Camp);
        }
        else
        {
            SwitchedPhase(GameplayPhase.Choosing);
        }
    }
Esempio n. 16
0
        void Select(int id)
        {
            Item   item   = holder.Items[id];
            SOItem SOItem = holder.GetItem(id);
            Cell   cell   = L_Cells[id].GetComponent <Cell>();

            Debug.Log("Select-" + id);
            for (int i = 0; i < L_Cells.Count; i++)
            {
                L_Cells[i].UnSelect();
                holder.Items[i].IsSelected = false;
            }
            cell.Select();
            item.IsSelected = true;
            GC.Ball.GetComponent <SpriteRenderer>().sprite = SOItem.Image;
            holder.Save();
        }
Esempio n. 17
0
    public void DisplayItemBox(SOItem item)
    {
        if (itemboxPopAnim != null)
        {
            itemboxPopAnim.Kill();
            itemboxFadeAnim.Kill();
        }
        itemBox.alpha = 0;
        itemBox.transform.localScale = new Vector3(1.1f, 1.1f, 1f);
        itemboxPopAnim  = itemBox.transform.DOScale(Vector3.one, 0.2f).SetEase(Ease.OutBack);
        itemboxFadeAnim = itemBox.DOFade(1f, 0.2f)
                          .OnComplete(() => itemboxFadeAnim = itemBox.DOFade(0, 1f).SetDelay(Mathf.Clamp(item.name.Length * 0.15f + item.description.Length * 0.05f, 3, 10)));

        itemBoxTitle.text  = $"You Picked Up: {item.name}!";
        itemBoxText.text   = item.description;
        itemBoxIcon.sprite = item.sprite;
    }
Esempio n. 18
0
        void ButtonClick(int id)
        {
            Item   item   = holder.Items[id];
            SOItem SOItem = holder.GetItem(id);
            Cell   cell   = L_Cells[id].GetComponent <Cell>();

            if (item.IsBuy)
            {
                Select(id);
            }
            else
            {
                Buy(id);
            }

            TextScore.text = GC.Data.Money.ToString();
            holder.Save();
        }
Esempio n. 19
0
    public int SpawnItem(SOItem toSpawn, Vector3 pos, Quaternion rot, Dictionary <string, string> startingProperties)
    {
        int rc = 0;

        if (toSpawn == null)
        {
            Debug.LogWarning("tospawn null");
            return(rc);
        }

        // one check
        if (toSpawn.ID == CONSTANTS.ITEM_FREESTAND_INGREDIENT)
        {
            if (!startingProperties.ContainsKey(CONSTANTS.CONTENTS_STRING))
            {
                Debug.LogError("Cannot create a Freestanding ingredient without contents");
                DeveloperConsole.instance.writeError("Cannot create a Freestanding ingredient without contents");
                return(rc);
            }
        }

        GameObject GO = Instantiate(toSpawn.model, pos, rot);
        IItem      i  = GO.GetComponentInChildren <IItem>();

        if (i != null)
        {
            i.uniqueID = currentID;
            string dictionaryString = "";
            foreach (string s in startingProperties.Keys)
            {
                dictionaryString += s + "=" + startingProperties[s] + " ";
                i.setProperty(s, startingProperties[s]);
            }
            Debug.Log("Spawned Item " + toSpawn.name + " with ID " + i.uniqueID + " at " + pos + " with rotation " + rot + " and properties " + dictionaryString);
            rc = currentID;
        }
        trackedObjects.Add(currentID, GO);
        currentID++;
        return(rc);
    }
Esempio n. 20
0
        void SetupCells()
        {
            int  count        = holder.ItemsCount;
            bool SelectedFind = false;

            for (int i = 0; i < count; i++)
            {
                GameObject goCell = Instantiate(ShopCell, ShopGrid.transform);
                SOItem     item   = holder.GetItem(i);
                Cell       cell   = goCell.GetComponent <Cell>();

                // Не пытаться поменять ButtonClick(id) на ButtonClick(i)
                //Это приведёт к одному и тому же числу во всех кнопках
                var id = i;
                cell.Init(item.Image, item.Price.ToString(), () => { ButtonClick(id); });
                //
                cell.name = "Cell_" + id;

                L_Cells.Add(cell);

                Item it = holder.Items[id];
                if (it.IsBuy)
                {
                    cell.Buy();
                }
                if (it.IsSelected)
                {
                    Select(id);
                    SelectedFind = true;
                }
            }

            L_Cells[0].Buy();
            if (!SelectedFind)
            {
                Buy(0);
                Select(0);
            }
        }
Esempio n. 21
0
 public bool CanBuy()
 {
     try
     {
         int   count = holder.ItemsCount;
         float money = GC.Data.Money;
         float bonus = GC.Data.GameScore;
         for (int i = 0; i < count; i++)
         {
             SOItem item  = holder.GetItem(i);
             Item   _item = holder.Items[i];
             if (item.Price <= money + bonus && !_item.IsBuy)
             {
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception e)
     {
         Debug.LogWarning(e);
         return(false);
     }
 }
Esempio n. 22
0
    void Start()
    {
        GameObject.Destroy(todelete);
        respawnCharacter();

        GameEvents.current.onPlayerDeath += onPlayerDeath;

        DeveloperConsole.instance.RegisterCommand("kill", "Kills the current player dead.", killPlayer);
        ic = GetComponent <ItemController>();

        // Spawn all cauldrons
        ContainerFiller[] liquidsIngredients = ContainerFiller.GetAllIngredientsByType(ContainerFiller.INGREDIENTTYPE.LIQUID);
        ContainerFiller[] liquidPotions      = ContainerFiller.GetAllPotionsByType(ContainerFiller.INGREDIENTTYPE.LIQUID);
        ContainerFiller[] solids             = ContainerFiller.GetAllByType(ContainerFiller.INGREDIENTTYPE.SOLID);
        ContainerFiller[] gases = ContainerFiller.GetAllByType(ContainerFiller.INGREDIENTTYPE.GAS);

        float offset = -3f;
        float z      = 0f;

        //Spawn cauldrons of potions
        //spawn an empty default one
        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_CAULDRON), new Vector3(11.54006f, 1.28f, z));
        z += offset;

        for (int i = 0; i < liquidPotions.Length; i++)
        {
            Dictionary <string, string> di = new Dictionary <string, string>();
            di.Add(CONSTANTS.CONTENTS_STRING, liquidPotions[i].ID.ToString());
            // this one has set contents not random
            ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_CAULDRON), new Vector3(11.54006f, 1.28f, z), di);
            z += offset;
        }

        // Spawn cauldrons of Ingredients
        //spawn an empty default one
        offset = -3f;
        z      = 0f;

        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_CAULDRON), new Vector3(15.4f, 1.28f, z));
        z += offset;

        for (int i = 0; i < liquidsIngredients.Length; i++)
        {
            Dictionary <string, string> di = new Dictionary <string, string>();
            di.Add(CONSTANTS.CONTENTS_STRING, liquidsIngredients[i].ID.ToString());
            // this one has set contents not random
            ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_CAULDRON), new Vector3(15.4f, 1.28f, z), di);
            z += offset;
        }



        // Spawn all bottles of potions
        offset = 0.5f;
        z      = 7f;

        //spawn an empty default one
        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_POTIONBOTTLE), new Vector3(z, 1.264f, 6.338f));
        z += offset;
        for (int i = 0; i < liquidPotions.Length; i++)
        {
            Dictionary <string, string> di = new Dictionary <string, string>();
            di.Add(CONSTANTS.CONTENTS_STRING, liquidPotions[i].ID.ToString());
            // this one has set contents not random
            ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_POTIONBOTTLE), new Vector3(z, 1.264f, 6.338f), di);
            z += offset;
        }

        // Spawn all bottles of ingredients
        offset = 0.5f;
        z      = 7f;

        //spawn an empty default one
        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_POTIONBOTTLE), new Vector3(z, 1.264f, 9.41f));
        z += offset;
        for (int i = 0; i < liquidsIngredients.Length; i++)
        {
            Dictionary <string, string> di = new Dictionary <string, string>();
            di.Add(CONSTANTS.CONTENTS_STRING, liquidsIngredients[i].ID.ToString());
            // this one has set contents not random
            ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_POTIONBOTTLE), new Vector3(z, 1.264f, 9.41f), di);
            z += offset;
        }

        // Spawn piles of ingredients
        offset = 0.5f;
        z      = 7.5f;
        for (int i = 0; i < solids.Length; i++)
        {
            Dictionary <string, string> di = new Dictionary <string, string>();
            di.Add(CONSTANTS.CONTENTS_STRING, solids[i].ID.ToString());
            // this one has set contents not random
            ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_FREESTAND_INGREDIENT), new Vector3(z, 1.5f, 17.4901f), di);
            z += offset;
        }

        // Spawn Bowls with ingredients
        // spawn empty one first
        offset = 0.5f;
        z      = 7.5f;
        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_BOWL), new Vector3(z, 1.124f, 12.96961f));
        z += offset;
        for (int i = 0; i < solids.Length; i++)
        {
            Dictionary <string, string> di = new Dictionary <string, string>();
            di.Add(CONSTANTS.CONTENTS_STRING, solids[i].ID.ToString());
            // this one has set contents not random
            ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_BOWL), new Vector3(z, 1.124f, 12.96961f), di);
            z += offset;
        }

        // Spawn remaining tools
        //Spawn a pestle and mortar
        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_PANDM), new Vector3(-8.778f, 1.05306f, -4.482306f));
        // Spawn a bucket
        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_BUCKET), new Vector3(-8.778f, 1.05306f, -5.109999f));
        // Spawn a drain
        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_DRAIN), new Vector3(-8.778f, 0.276f, -2.195f));
        // Spawn a bin
        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_BIN), new Vector3(-8.778f, 0.409f, -0.855f));
        // Spawn a pot
        ic.SpawnItem(SOItem.GetByID(CONSTANTS.ITEM_POT), new Vector3(-8.778f, 1.05306f, -6.109999f));
    }
Esempio n. 23
0
    void TestSOs()
    {
        //test ContainerFiller
        {
            ContainerFiller[]        toCheck   = ContainerFiller.GetAll();
            Dictionary <int, string> potionIDs = new Dictionary <int, string>();
            foreach (ContainerFiller s in toCheck)
            {
                if (potionIDs.ContainsKey(s.ID))
                {
                    Debug.LogError("ERROR: ContainerFiller " + s.name + " has the same ID as " + potionIDs[s.ID] + " = " + s.ID);
                }
                else
                {
                    potionIDs.Add(s.ID, s.name);
                }
                // Check for null parameters
                if (s.color == null)
                {
                    Debug.LogError("ERROR: ContainerFiller " + s.name + " has a NULL Color");
                }
                if (s.onConsumeEffect == null)
                {
                    Debug.LogError("ERROR: ContainerFiller " + s.name + " has a NULL onConsumeEffect");
                }
                if (s.onGroundModel == null)
                {
                    Debug.LogError("ERROR: ContainerFiller " + s.name + " has a NULL onGroundModel");
                }
                if (s.texture == null)
                {
                    Debug.LogError("ERROR: ContainerFiller " + s.name + " has a NULL Texture");
                }
            }
        }

        {
            //test effects
            SOEffect[] toCheck = SOEffect.GetAll();
            Dictionary <int, string> effectIDs = new Dictionary <int, string>();
            foreach (SOEffect s in toCheck)
            {
                if (effectIDs.ContainsKey(s.ID))
                {
                    Debug.LogError("ERROR: SOEffect " + s.name + " has the same ID as " + effectIDs[s.ID] + " = " + s.ID);
                }
                else
                {
                    effectIDs.Add(s.ID, s.name);
                }
            }
        }

        {
            //test items
            SOItem[] toCheck = SOItem.GetAll();
            Dictionary <int, string> itemIDs = new Dictionary <int, string>();
            foreach (SOItem s in toCheck)
            {
                if (itemIDs.ContainsKey(s.ID))
                {
                    Debug.LogError("ERROR: SOItem " + s.name + " has the same ID as " + itemIDs[s.ID] + " = " + s.ID);
                }
                else
                {
                    itemIDs.Add(s.ID, s.name);
                }
                if (s.model == null)
                {
                    Debug.LogError("ERROR: SOItem " + s.name + " has a NULL model");
                }
            }
        }

        {
            //test Recipes
            SORecipe[] toCheck = SORecipe.GetAll();
            Dictionary <int, string> itemIDs = new Dictionary <int, string>();
            foreach (SORecipe s in toCheck)
            {
                if (itemIDs.ContainsKey(s.ID))
                {
                    Debug.LogError("ERROR: SORecipe " + s.name + " has the same ID as " + itemIDs[s.ID] + " = " + s.ID);
                }
                else
                {
                    itemIDs.Add(s.ID, s.name);
                }
                if (s.result == null)
                {
                    Debug.LogError("ERROR: SORecipe " + s.name + " has a NULL result");
                }
                if (s.ingredients == null)
                {
                    Debug.LogError("ERROR: SORecipe " + s.name + " has a NULL ingredients");
                }
                else if (s.ingredients.Length < 2)
                {
                    Debug.LogError("ERROR: SORecipe " + s.name + " has a less than 2 ingredients");
                }
                else
                {
                    foreach (ContainerFiller c in s.ingredients)
                    {
                        if (c == null)
                        {
                            Debug.LogError("ERROR: SORecipe " + s.name + " contains a NULL ingredient in it's list.");
                            break;
                        }
                    }
                }
            }
        }
    }
Esempio n. 24
0
 // Spawn items
 public int SpawnItem(SOItem toSpawn, Vector3 pos)
 {
     return(SpawnItem(toSpawn, pos, new Quaternion(0, 0, 0, 0), new Dictionary <string, string>()));
 }
Esempio n. 25
0
 public int SpawnItem(SOItem toSpawn, Vector3 pos, Quaternion rot)
 {
     return(SpawnItem(toSpawn, pos, rot, new Dictionary <string, string>()));
 }
Esempio n. 26
0
 public int SpawnItem(SOItem toSpawn, Vector3 pos, Dictionary <string, string> startingProperties)
 {
     return(SpawnItem(toSpawn, pos, new Quaternion(0, 0, 0, 0), startingProperties));
 }
Esempio n. 27
0
 public bool UseItem(SOItem item) => Player.current.UseItem(item);
Esempio n. 28
0
    public bool devConsoleSpawn(string[] parameters)
    {
        SOItem tospawn;

        Vector3 pos = gc.getCurrentCharPos();

        Quaternion rot = gc.getCurrentCharRot();

        switch (parameters.Length)
        {
        case 3:
            String[] rotcoms = parameters[2].Split(',');
            if (rotcoms.Length != 4)
            {
                DeveloperConsole.instance.writeError("Incorrect rotation parameter. Expected x,x,x,x !");
                return(false);
            }
            int[] rotcomsint = new int[rotcoms.Length];
            for (int i = 0; i < rotcoms.Length; i++)
            {
                if (!Int32.TryParse(rotcoms[i], out int temp))
                {
                    DeveloperConsole.instance.writeError("Incorrect rotation parameter. Expected x,x,x,x !");
                    return(false);
                }
                else
                {
                    rotcomsint[i] = temp;
                }
            }

            rot = new Quaternion(rotcomsint[0], rotcomsint[1], rotcomsint[2], rotcomsint[3]);
            //fallthrough
            goto case 2;

        case 2:
            String[] poscoms = parameters[1].Split(',');
            if (poscoms.Length != 3)
            {
                DeveloperConsole.instance.writeError("Incorrect posistion parameter. Expected x,x,x !");
                return(false);
            }
            int[] poscomsint = new int[poscoms.Length];
            for (int i = 0; i < poscoms.Length; i++)
            {
                if (!Int32.TryParse(poscoms[i], out int temp2))
                {
                    DeveloperConsole.instance.writeError("Incorrect posistion parameter. Expected x,x,x !");
                    return(false);
                }
                else
                {
                    poscomsint[i] = temp2;
                }
            }

            pos = new Vector3(poscomsint[0], poscomsint[1], poscomsint[2]);
            //fallthrough
            goto case 1;

        case 1:
            if (!Int32.TryParse(parameters[0], out int temp3))
            {
                DeveloperConsole.instance.writeError("Incorrect ID parameter. Expected x!");
                return(false);
            }
            else
            {
                tospawn = SOItem.GetByID(temp3);
                if (tospawn == null)
                {
                    DeveloperConsole.instance.writeError("Unknown ID parameter!");
                    return(false);
                }
            }
            break;

        default:
            DeveloperConsole.instance.writeError("Incorrect parameters!");
            return(false);
        }

        int id = SpawnItem(tospawn, pos, rot);

        if (id != 0)
        {
            DeveloperConsole.instance.writeMessage("Spawned item " + tospawn.name + " with ID " + id);
            return(true);
        }
        else
        {
            DeveloperConsole.instance.writeError("Failed to spawn item!");
            return(false);
        }
    }
Esempio n. 29
0
 public void GiveItem(SOItem item) => Player.current.AddItem(item);
 public void UpgradeWeapon(SOItem ItemToUpgrade)
 {
     ItemToUpgrade.Damage      += ItemToUpgrade.DamagePerLevel;
     ItemToUpgrade.AttackSpeed += ItemToUpgrade.AttackSpeedPerLevel;
 }