示例#1
0
    public void CreateBullet(BulletDepot.Bullet bullet, BulletType type = BulletType.Knife)
    {
        int angle = bullet.angle + (int)playerMovement.CurrentShotAngle();
        //Debug.Log("CreateBullet(): angle =" + angle + " playerMovement.CurrentShotAngle = " + (int)playerMovement.CurrentShotAngle());  //ski

        GameObject newBullet = bullets.GetBullet();

        newBullet.transform.position = gameObject.transform.position;
        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>();

        if (poweredUpBullets)
        {
            bulletLogic.Initialize(type, bullet.damage * 2, bullet.speed, bullet.size, 5, playerStats.playerColor, playerStats.number, playerStats.character);
        }
        else
        {
            bulletLogic.Initialize(type, bullet.damage, bullet.speed, bullet.size, 5, playerStats.playerColor, playerStats.number, playerStats.character);
        }
        newBullet.GetComponentInChildren <SpriteRenderer>().sortingOrder = 9 - bufferIter;
        //Debug.Log("Sorting layer debug thing " + newBullet.GetComponentInChildren<SpriteRenderer>().sortingOrder);
        //Debug.Log("bullet " + newBullet.gameObject.name + " rotation = " + newBullet.transform.rotation);
    }
示例#2
0
    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();
    }
示例#3
0
 void OffScreenFinalShot()
 {
     for (int i = 0; i < 4; i++)
     {
         GameObject newBullet = bullets.GetBullet();
         newBullet.transform.position = new Vector3(-30 + (15 * i), 20, 0);
         newBullet.transform.rotation = Quaternion.Euler(0f, 0f, 270f);
         BulletLogic bulletLogic = newBullet.GetComponent <BulletLogic>();
         // just values I'm making up
         bulletLogic.Initialize(BulletType.Boomerang, 10, 20, 2, 10, playerStats.playerColor, playerStats.number, playerStats.character);
         newBullet.GetComponentInChildren <SpriteRenderer>().sortingOrder = 9 - bufferIter;
     }
     for (int i = 0; i < 4; i++)
     {
         GameObject newBullet = bullets.GetBullet();
         newBullet.transform.position = new Vector3(-30 + (15 * i), -20, 0);
         newBullet.transform.rotation = Quaternion.Euler(0f, 0f, 90f);
         BulletLogic bulletLogic = newBullet.GetComponent <BulletLogic>();
         // just values I'm making up
         bulletLogic.Initialize(BulletType.Boomerang, 10, 20, 2, 10, playerStats.playerColor, playerStats.number, playerStats.character);
         newBullet.GetComponentInChildren <SpriteRenderer>().sortingOrder = 9 - bufferIter;
     }
     for (int i = 0; i < 4; i++)
     {
         GameObject newBullet = bullets.GetBullet();
         newBullet.transform.position = new Vector3(-35, -15 + (i * 8), 0);
         newBullet.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
         BulletLogic bulletLogic = newBullet.GetComponent <BulletLogic>();
         // just values I'm making up
         bulletLogic.Initialize(BulletType.Boomerang, 10, 20, 2, 10, playerStats.playerColor, playerStats.number, playerStats.character);
         newBullet.GetComponentInChildren <SpriteRenderer>().sortingOrder = 9 - bufferIter;
     }
     for (int i = 0; i < 4; i++)
     {
         GameObject newBullet = bullets.GetBullet();
         newBullet.transform.position = new Vector3(35, -15 + (i * 8), 0);
         newBullet.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
         BulletLogic bulletLogic = newBullet.GetComponent <BulletLogic>();
         // just values I'm making up
         bulletLogic.Initialize(BulletType.Boomerang, 10, 20, 2, 10, playerStats.playerColor, playerStats.number, playerStats.character);
         newBullet.GetComponentInChildren <SpriteRenderer>().sortingOrder = 9 - bufferIter;
     }
 }