示例#1
0
 //死亡以后清除所有屏幕上的弹幕 并且播放清除特效
 private void ClearAllBullet()
 {
     GameObject[] bulletInScreen = GameObject.FindGameObjectsWithTag("EnemyBullet");
     //BulletBase_Touhou[] bulletInScreen = UIShootRoot.tra_ShootRoot.GetComponentsInChildren<BulletBase_Touhou>();
     foreach (GameObject go in bulletInScreen)
     {
         BulletBase_Touhou bullet = go.GetComponent <BulletBase_Touhou>();
         bullet.ShowVanishEffect();
         GameObject.Destroy(go);
     }
 }
示例#2
0
    //void FixedUpdate()
    //{
    //    rigidbody2D.velocity = shootBulletSpeed;
    //}

    //给生成的子弹赋值
    private void InitBullet()
    {
        GameObject shot = Instantiate(projectilePrefab) as GameObject;

        shot.transform.parent     = UIEmitterRoot.tra_ShootRoot;
        shot.transform.position   = this.transform.position;
        shot.transform.localScale = Vector3.one;

        BulletBase_Touhou shotScript = shot.GetComponent <BulletBase_Touhou>();

        shotScript.Speed = shootBulletSpeed;
    }
示例#3
0
    /// <summary>
    /// 初始化一个子弹的位置的出现效果
    /// </summary>
    /// <param name="bullet"></param>
    /// <param name="position"></param>
    /// <param name="direct"></param>
    void InitOneBulletPosAndEffect(GameObject bullet, Vector2 position, Vector2 direct)
    {
        bullet.transform.position   = position;
        bullet.transform.parent     = UIEmitterRoot.tra_ShootRoot;
        bullet.transform.localScale = Vector3.one;

        BulletBase_Touhou bulletBase = bullet.GetComponent <BulletBase_Touhou>();

        bulletBase.renderer.sortingLayerName = bulletLayerName;
        bulletBase.RotationWithDirction(direct);
        bulletBase.rigidbody2D.velocity = direct * SpeedScale;

        //生产发子弹的特效
        GameObject effect = GameObject.Instantiate(Resources.Load(CommandString.BulletPrefabPath + "ShootBulletEffect")) as GameObject;

        effect.transform.parent     = UIEmitterRoot.tra_ShootRoot;
        effect.transform.position   = bullet.transform.position;
        effect.transform.localScale = Vector3.one * 2;
    }
示例#4
0
    protected override void InitBullet()
    {
        base.InitBullet();
        GameObject bullet = Instantiate(BulletPrefab) as GameObject;

        bullet.transform.position = this.transform.position;
        BulletBase_Touhou bulletBase = bullet.GetComponent <BulletBase_Touhou>();

        bulletBase.renderer.sortingLayerName = bulletLayerName;
        bulletBase.RotationToTarget(MyPlane.MyPos);
        bulletBase.rigidbody2D.velocity = getDirByTarget(MyPlane.MyPos) * SpeedScale;
        bullet.transform.parent         = UIEmitterRoot.tra_ShootRoot;
        bullet.transform.position       = (Vector2)transform.position;
        bullet.transform.localScale     = Vector3.one;


        //生产发子弹的特效
        GameObject effect = GameObject.Instantiate(Resources.Load(CommandString.BulletPrefabPath + "ShootBulletEffect")) as GameObject;

        effect.transform.parent     = UIEmitterRoot.tra_ShootRoot;
        effect.transform.position   = bullet.transform.position;
        effect.transform.localScale = Vector3.one * 2;
    }