Пример #1
0
    public void respawn()
    {
        Transform child = SpawnItems.model.transform.FindChild("spawns").GetChild(UnityEngine.Random.Range(0, SpawnItems.model.transform.FindChild("spawns").childCount));

        if ((int)SpawnItems.getItems(child.position, 2f).Length == 0)
        {
            int loot = Loot.getLoot(child.name);
            int type = ItemType.getType(loot);
            if (ItemWeight.getWeight(loot) != -1000 || type == 30)
            {
                if (type == 10)
                {
                    SpawnItems.spawnItem(loot, UnityEngine.Random.Range(1, ItemAmount.getAmount(loot) + 1), child.position);
                }
                else if (type == 25)
                {
                    for (int i = 0; i < UnityEngine.Random.Range(1, 4); i++)
                    {
                        SpawnItems.spawnItem(loot, ItemAmount.getAmount(loot), child.position + new Vector3(UnityEngine.Random.Range(-0.5f, 0.5f), 0f, UnityEngine.Random.Range(-0.5f, 0.5f)));
                    }
                }
                else if (loot == 30000)
                {
                    SpawnItems.spawnItem(11, 1, child.position);
                    SpawnItems.spawnItem(4017, 1, child.position);
                    SpawnItems.spawnItem(5017, 1, child.position);
                }
                else if (loot != 30001)
                {
                    SpawnItems.spawnItem(loot, ItemAmount.getAmount(loot), child.position);
                }
                else
                {
                    SpawnItems.spawnItem(12, 1, child.position);
                    SpawnItems.spawnItem(4018, 1, child.position);
                    SpawnItems.spawnItem(5018, 1, child.position);
                }
            }
        }
    }