Пример #1
0
    public void ItemDropFormDead()
    {
        switch (typeItemDrop)
        {
        case TypeItemDrop.coin:
            if (!enemyAutoSpawn)
            {
                if (haveCoin && GameController.instance.totalDropCoin > 0)
                {
                    randomCoin = Random.Range(3, 5);
                    if (GameController.instance.totalDropCoin - randomCoin < 0)
                    {
                        randomCoin = GameController.instance.totalDropCoin;
                    }
                    GameController.instance.totalDropCoin -= randomCoin;
                    GameController.instance.SpawnCoin(randomCoin, transform.position);
                }
            }
            break;

        case TypeItemDrop.health:
            if (DataUtils.modeSelected == 0)
            {
                itemDrop = ObjectPoolManagerHaveScript.Instance.itemHealthPooler.GetItemPooledObject();
                itemDrop.transform.position = gameObject.transform.position;
                itemDrop.AddNumberTemp(percentHealthForPlayer);
                itemDrop.gameObject.SetActive(true);
            }
            break;

        case TypeItemDrop.gun:
            if (DataUtils.modeSelected == 0)
            {
                itemDrop = ObjectPoolManagerHaveScript.Instance.gunItemPooler.GetItemPooledObject();
                itemDrop.transform.position = gameObject.transform.position;
                itemDrop.index = (int)percentHealthForPlayer /*Random.Range(0, GameController.instance.gunSprite.Count)*/;
                itemDrop.gameObject.SetActive(true);
            }
            break;
        }

        if (isMachine)
        {
            SoundController.instance.PlaySound(soundGame.soundexploenemy);
            exploDie = ObjectPoolerManager.Instance.enemyMachineExploPooler.GetPooledObject();
            exploDie.transform.position = gameObject.transform.position;
            exploDie.SetActive(true);
        }
        else
        {
            if (index >= 20 && index <= 24)
            {
                return;
            }
            SoundController.instance.PlaySound(soundGame.soundexploenemy);
            exploDie = ObjectPoolerManager.Instance.enemyExploPooler.GetPooledObject();
            exploDie.transform.position = gameObject.transform.position;
            exploDie.SetActive(true);
        }
    }