protected override void FireOnTarget(BaseDamagable target) { var missile = MasterPooler.Get <Missile>(transform.position, transform.rotation); if (target == null) { Debug.Log("Faulty"); missile.LaunchMissile(this, null, 2); return; } missile.LaunchMissile(this, target, 6); }
protected override void Explode() { var deathEffect = MasterPooler.Get <AsteroidDeathEffect>(transform.position, transform.rotation); deathEffect.transform.localScale = transform.localScale; deathEffect.OnEffectEnd += EndDeathEffect; deathEffect.Play(); if (OnDeath != null) { OnDeath(this); } }
public Asteroid SpawnAsteroid(int level, Vector3 position, Vector2 fling) { if (Context.Instance.PlayerCount == 0) { return(null); } var asteroid = MasterPooler.Get <Asteroid>(position, Quaternion.identity); var asteroidRB = asteroid.GetComponent <Rigidbody2D>(); asteroid.transform.localScale = Vector3.one * Size[level]; asteroid.Level = level; asteroid.SetHitpoints(Health[level], Health[level]); asteroid.OnDeath += OnAsteroidDeath; asteroidRB.AddForce(fling, ForceMode2D.Impulse); asteroidRB.mass = Mass[level]; return(asteroid); }
protected override void Explode() { _isActive = false; var targets = Physics2D.CircleCastAll(transform.position, _explosionRadius, transform.up); foreach (var hit in targets) { var damagable = hit.transform.GetComponent <BaseDamagable>(); if (damagable != null) { damagable.TakeDamage(_owner.GunDamage); } } var effect = MasterPooler.Get <MissileExplodeEffect>(transform.position, transform.rotation); effect.OnEffectEnd += OnEffectEnd; effect.Play(); gameObject.SetActive(false); }
protected override void FireOnTarget(BaseDamagable target) { var bomb = MasterPooler.Get <Bomb>(transform.position, transform.rotation); bomb.LaunchBomb(this, 20); }
private void FireMissile(float directionMod) { var missile = MasterPooler.Get <Missile>(transform.position, transform.rotation); missile.Shoot(directionMod); }