Example #1
0
 private IEnumerator ShotHelp()
 {
     for (int i = 0; i < 5; i++)
     {
         float      distance = 0.2f;
         Vector3    random   = new Vector3(Random.Range(-distance, distance), Random.Range(-distance, distance), Random.Range(-distance, distance));
         GameObject temp     = GameObject.Instantiate(m_View.Prefab_Bullet, m_View.ShootPos.position + random,
                                                      Quaternion.identity, m_View.Bullet_Parents);
         BulletHelp tempBulletHelp = temp.GetComponent <BulletHelp>();
         if (tempBulletHelp == null)
         {
             tempBulletHelp = temp.AddComponent <BulletHelp>();
         }
         tempBulletHelp.Shoot(m_View.ShootPos.forward, 3000, Damage / 5);
         Durable--;
         yield return(new WaitForSeconds(0.01f));
     }
     StartCoroutine(DelayTime());
 }
Example #2
0
    /// <summary>
    /// 射击辅助函数.
    /// </summary>
    /// <returns></returns>
    private IEnumerator ShootHelp()
    {
        if (Durable > 0)
        {
            PlayAudio();
            PlayEffect();

            GameObject temp           = GameObject.Instantiate(m_View.Prefab_Bullet, m_View.ShootPos.position, Quaternion.identity, m_View.Bullet_Parents);
            BulletHelp tempBulletHelp = temp.GetComponent <BulletHelp>();
            if (tempBulletHelp == null)
            {
                tempBulletHelp = temp.AddComponent <BulletHelp>();
            }
            tempBulletHelp.Shoot(m_View.ShootPos.forward, 3000, Damage);
            Durable--;


            yield return(new WaitForSeconds(0.1f));

            CanShoot = true;
        }
    }