Пример #1
0
    /// <summary>
    /// Boss scatters a certain amount of bombs randomly around himself
    /// </summary>
    void SpreadBombs(int amountOfBombs)
    {
        // determine position of boss
        Vector2 bossPosition = transform.position;

        for (int i = 0; i < amountOfBombs; i++)
        {
            // determine positions bombs will stop
            Vector2 pos = bossPosition + UnityEngine.Random.insideUnitCircle * bombRadius;

            // spawn bombs at boss position
            GameObject tmp = Instantiate(bossBomb, bossPosition, Quaternion.identity);

            // Identify the script on the bomb
            LerpToPosition script = tmp.GetComponent <LerpToPosition>();

            // send bombs from boss position to stop position
            script.SetStartAndDestination(bossPosition, pos, tmp);
        }


        // play bomb sounds
        // SoundManager.instance.PlayUiSound("lootdrop");
    }