Example #1
0
        private void OnItemCollider(int index, VirusBase virus)
        {
            base.OnUnitFire(index);
            units[index].SetReady(false);
            Vector2 cDir = virus.position - units[index].position;
            Vector2 dir  = (cDir + virus.direction).normalized;

            virus.SetDirection(dir);
            Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, virus, damage));
            ExplosionWeaponCoverItem.Create().Reset(units[index].position, table.explosionSound);
        }
Example #2
0
        protected override void OnHit(VirusBase virus)
        {
            base.OnHit(virus);
            var hitPos = position + direction * 50;

            AreaHit(hitPos, effects[1] * 0.5f, (_vv) =>
            {
                Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, _vv, damage));
            });
            ExplosionWeaponMissileBullet.Create().Reset(hitPos, effects[1], explosionSound);
            ForceRecycle();
        }
 private void CheckHit()
 {
     foreach (var _v in EntityManager.GetAll <VirusBase>())
     {
         var virus = _v as VirusBase;
         if (!virus.isAlive || virus.isInvincible)
         {
             continue;
         }
         if (virus.position.y > position.y &&
             Mathf.Abs(virus.position.x - position.x) < effects[1] * 0.5f + virus.radius)
         {
             Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, virus, damage));
         }
     }
 }
Example #4
0
        protected override void OnHit(VirusBase virus)
        {
            base.OnHit(virus);
            if (virus.isAlive && !virus.isInvincible)
            {
                Vector2 cDir = virus.position - position;
                Vector2 dir  = (cDir + virus.direction).normalized;
                virus.SetDirection(dir);
                Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, virus, damage));
            }

            mHitCount--;
            if (mHitCount <= 0)
            {
                ForceRecycle();
                AudioManager.PlaySound(explosionSound);
            }
        }
Example #5
0
        private void OnTriggerEnter2D(Collider2D _collider)
        {
            if (!isAlive)
            {
                return;
            }

            if (_collider.tag == TagUtil.Virus)
            {
                var virus = _collider.GetComponent <VirusBase>();
                if (virus != null && virus.isAlive)
                {
                    Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, virus, mDamage));
                    PlayExplosion(virus.rectTransform.GetUIPos(), virus.radius);
                    Recycle();
                    isAlive = false;
                }
            }
        }