Beispiel #1
0
    private void Fire()
    {
        float           angle     = Random.Range(0, 360);
        GameObject      bulletObj = Instantiate(spiderBulletPfb, transform.position, Quaternion.identity);
        IBulletMovement bullet    = bulletObj.GetComponent <IBulletMovement>();

        bullet.Speed = speed;
        bullet.Angle = angle;
    }
Beispiel #2
0
 private void Fire()
 {
     for (int i = 0; i < 8; i++)
     {
         float           angle     = i * 360 / 8;
         GameObject      bulletObj = Instantiate(bulletPfb, transform.position, Quaternion.identity);
         IBulletMovement bullet    = bulletObj.GetComponent <IBulletMovement>();
         bullet.Speed = 5f;
         bullet.Angle = angle;
     }
 }
        private void Init()
        {
            m_CollisionTrigger = GetComponentInChildren <ObservableTriggerTrigger>();
            m_Movement         = GetComponent <IBulletMovement>();

            m_CollisionTrigger
            .OnTriggerEnterAsObservable()
            .Subscribe(CollisionRedirection)
            .AddTo(this);
            m_Init = true;
        }
    public void GetBullet(Transform Gun, int bulletMovementType)
    {
        var bullet = _bulletPool.GetObjectFromPool();

        bullet.transform.position = Gun.position;
        bullet.transform.rotation = Gun.rotation;
        switch (bulletMovementType)
        {
        case 1:
            _strategyBulletMovement_Normal = new NormalMovement();
            bullet.SetBulletMovement(_strategyBulletMovement_Normal);
            break;

        case 2:
            _strategyBulletMovement_Circular = new CircularMovement();
            bullet.SetBulletMovement(_strategyBulletMovement_Circular);
            break;
        }
        bullet.SetBulletPool(this);
    }
Beispiel #5
0
 public void SetBulletMovement(IBulletMovement bulletMovement)
 {
     _currentBulletMovement = bulletMovement;
     _currentBulletMovement.SetBulletTransform(this.transform);
     _currentBulletMovement.SetBulletSpeed(speed);
 }