void OffScreenShot()
    {
        BulletType type = BulletType.Boomerang;
        Direction  dir  = playerMovement.lastDirection;

        BulletDepot.Volley volley = bullets.types[(int)playerStats.character].projectileTypes[(int)type].volleys[bufferIter];



        for (int i = 0; i < volley.volley.Length; i++)
        {
            BulletDepot.Bullet bullet = volley.volley[i];
            int        angle          = bullet.angle + (int)playerMovement.CurrentShotAngle();
            GameObject newBullet      = bullets.GetBullet();
            switch (dir)
            {
            case Direction.Right:
                newBullet.transform.position = new Vector3(42, -25 + (60 / volley.volley.Length) * i, 0);
                break;

            case Direction.Left:
                newBullet.transform.position = new Vector3(-42, -25 + (60 / volley.volley.Length) * i, 0);
                break;

            case Direction.Down:
                newBullet.transform.position = new Vector3(-42 + (60 / volley.volley.Length) * i, -25, 0);
                break;

            case Direction.Up:
                newBullet.transform.position = new Vector3(-42 + (60 / volley.volley.Length) * i, 25, 0);
                break;
            }

            newBullet.transform.rotation = Quaternion.Euler(0, 0, angle);
            BulletLogic bulletLogic = newBullet.GetComponent <BulletLogic>();           //((GameObject)Instantiate(bulletPrefab, gameObject.transform.position, Quaternion.Euler(0, 0, angle))).GetComponent<BulletLogic>();
            bulletLogic.Initialize(type, bullet.damage, bullet.speed, bullet.size, lifetime, playerStats.playerColor, playerStats.number, playerStats.character);
            bulletLogic.indirectHomingTime      = 10.5f;
            bulletLogic.indirectHomingLimit     = 1.0f;
            bulletLogic.indirectCorrectionSpeed = 1.5f;
            newBullet.GetComponentInChildren <SpriteRenderer>().sortingOrder = 9 - bufferIter;
        }
        soundEffects.clip = Resources.Load <AudioClip>("audio/soundEffects/boomerangSound");
        soundEffects.Play();
    }
Beispiel #2
0
    public void ExponentShot()
    {
        BulletType type = BulletType.Knife;

        switch (GetButtonPress())
        {
        case 'A':
            type = BulletType.Knife;
            break;

        case 'B':
            type = BulletType.Boomerang;
            break;

        case 'C':
            type = BulletType.Shield;
            break;

        case 'D':
            break;
        }

        BulletDepot.Volley volley = bullets.types[(int)playerStats.character].projectileTypes[(int)type].volleys[bufferIter];

        foreach (BulletDepot.Bullet bullet in volley.volley)
        {
            CreateBullet(bullet, type);
        }
        switch (type)
        {
        case BulletType.Boomerang:
            soundEffects.clip = Resources.Load <AudioClip>("audio/soundEffects/boomerangSound");
            break;

        case BulletType.Knife:
            soundEffects.clip = Resources.Load <AudioClip>("audio/soundEffects/knifeSound");
            break;

        case BulletType.Shield:
            soundEffects.clip = Resources.Load <AudioClip>("audio/soundEffects/shieldSound");
            break;
        }
        soundEffects.Play();
    }