コード例 #1
0
    //Fonction de mort
    public void death()
    {
        int chance = Random.Range(1, 101);
        int choice;

        Destroy(gameObject);
        EnemySpawner spawner = FindObjectOfType <EnemySpawner>();

        spawner.CleanList();

        if (chance <= dropChance)
        {
            choice = Random.Range(1, 4);
            switch (choice)
            {
            case 1:
                Instantiate(gelBottle, transform.position, transform.rotation);
                break;

            case 2:
                Instantiate(mask, transform.position, transform.rotation);
                break;

            case 3:
                Instantiate(radio, transform.position, transform.rotation);
                break;
            }
        }
    }