コード例 #1
0
    public void shootProjectile()
    {
        int rngesus = Random.Range(0, 100);

        if (rngesus <= 66)
        {
            Instantiate(projectilePrefab, transform.position, Quaternion.identity);
        }
        else if (rngesus <= 80)
        {
            Instantiate(slowProjectilePrefab);
        }
        else
        {
            Instantiate(fastProjectilePrefab);
        }
        if (shieldScript.getBlockCount() < 100)
        {
            projectileSpeed += .01f;
            if (shieldScript.getBlockCount() % 4 == 0)
            {
                spawnRate -= .035f;
            }
        }
        else
        {
            if (shieldScript.getBlockCount() % 6 == 0)
            {
                spawnRate -= .01f;
                if (spawnRate < .1)
                {
                    spawnRate = .1f;
                }
                projectileSpeed += .008f;
            }
        }
    }
コード例 #2
0
ファイル: PortalScript.cs プロジェクト: toki1/Block-PNG
    public void shootProjectile()
    {
        int rngesus = Random.Range(0, 100);

        if (rngesus <= 66)
        {
            portalIndex = Random.Range(0, portals.Length);
            Vector3 v3 = portals[portalIndex].transform.position;
            Debug.Log(portalIndex + "   " + v3);
            if (portalIndex == 0)
            {
                Instantiate(projectilePrefab, v3, Quaternion.Euler(0, 0, 270));
            }
            else if (portalIndex == 1)
            {
                Instantiate(projectilePrefab, v3, Quaternion.Euler(0, 0, 180));
            }
            else if (portalIndex == 2)
            {
                Instantiate(projectilePrefab, v3, Quaternion.Euler(0, 0, 90));
            }
            else if (portalIndex == 3)
            {
                Instantiate(projectilePrefab, v3, Quaternion.Euler(0, 0, 0));
            }
        }
        else if (rngesus <= 80)
        {
            portalIndex = Random.Range(0, portals.Length);
            Vector3 v3 = portals[portalIndex].transform.position;
            if (portalIndex == 0)
            {
                Instantiate(slowProjectilePrefab, v3, Quaternion.Euler(0, 0, 270));
            }
            else if (portalIndex == 1)
            {
                Instantiate(slowProjectilePrefab, v3, Quaternion.Euler(0, 0, 180));
            }
            else if (portalIndex == 2)
            {
                Instantiate(slowProjectilePrefab, v3, Quaternion.Euler(0, 0, 90));
            }
            else if (portalIndex == 3)
            {
                Instantiate(slowProjectilePrefab, v3, Quaternion.Euler(0, 0, 0));
            }
        }
        else
        {
            portalIndex = Random.Range(0, portals.Length);
            Vector3 v3 = portals[portalIndex].transform.position;
            Debug.Log("" + v3);
            if (portalIndex == 0)
            {
                Instantiate(fastProjectilePrefab, v3, Quaternion.Euler(0, 0, 270));
            }
            else if (portalIndex == 1)
            {
                Instantiate(fastProjectilePrefab, v3, Quaternion.Euler(0, 0, 180));
            }
            else if (portalIndex == 2)
            {
                Instantiate(fastProjectilePrefab, v3, Quaternion.Euler(0, 0, 90));
            }
            else if (portalIndex == 3)
            {
                Instantiate(fastProjectilePrefab, v3, Quaternion.Euler(0, 0, 0));
            }
        }
        if (shieldScript.getBlockCount() < 100)
        {
            projectileSpeed += .01f;
            if (shieldScript.getBlockCount() % 4 == 0 && temp != shieldScript.getBlockCount())
            {
                spawnRate -= .035f;
            }
            temp = shieldScript.getBlockCount();
        }
        else
        {
            if (shieldScript.getBlockCount() % 6 == 0 && temp != shieldScript.getBlockCount())
            {
                spawnRate -= .01f;
                if (spawnRate < .1)
                {
                    spawnRate = .1f;
                }
                projectileSpeed += .008f;
            }
            temp = shieldScript.getBlockCount();
        }
    }