Exemplo n.º 1
0
    private void Update()
    {
        if (GameState.Pause == GameMgr.instance.gameState)
        {
            return;
        }

        // 敌机下落
        m_selfTrans.position += new Vector3(0, -moveSpeed * Time.deltaTime, 0);

        // 超过屏幕下面
        if (Camera.main.WorldToScreenPoint(m_selfTrans.position).y <= -50)
        {
            BackToPool();
        }

        if (m_timeToFire > 0)
        {
            m_timeToFire -= Time.deltaTime;
            if (m_timeToFire <= 0)
            {
                EnemyBulletGenerator.GenerateBulletByAircraftType(aircraftType, m_selfTrans.position);
            }
        }
    }
Exemplo n.º 2
0
 // Use this for initialization
 void Awake()
 {
     observer    = FindObjectOfType <GameManager>();
     canShoot    = 1f;
     _bulletPool = GetComponent <EnemyBulletGenerator>();
     _allObservers.Add(observer);
 }
Exemplo n.º 3
0
 // Use this for initialization
 void Awake()
 {
     observer    = FindObjectOfType <GameManager>();
     canShoot    = 0.3f;
     _bulletPool = GetComponent <EnemyBulletGenerator>();
     _allObservers.Add(observer);
     //Movement
     strategyMovement_Normal  = new NormalAdvance(_speed, this.transform);
     strategyMovement_Sinuous = new SinuousAdvance(_speed, 10f, this.transform);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 清理飞机和子弹物体
 /// </summary>
 public void ClearObjs()
 {
     if (null != player)
     {
         player.DestroySelf();
     }
     // 清空所有飞机
     AircraftFactory.DestroyFactoryRoot();
     m_enemyGenerator.ClearAll();
     // 清空所有子弹
     EnemyBulletGenerator.CLear();
 }
 private void Awake()
 {
     _instance   = this;
     _bulletPool = new Pool <EnemyBullet>(amount, BulletFactory, EnemyBullet.InitializeBullet, EnemyBullet.DisposeBullet, true);
     cant        = 1;
 }
Exemplo n.º 6
0
 public void SetBulletPool(EnemyBulletGenerator bulletPool)
 {
     _bulletPool = bulletPool;
 }