// Use this for initialization protected virtual void Start() { //Debug.Log("Starting bullet"); rb = GetComponent <Rigidbody>(); //Destroy(gameObject, lifeTime); //audioSource = GetComponent<AudioSource>(); // explosiveBullet = GetComponent <ExplosiveBullet>(); // bulletSoundManager = FindObjectOfType <AudioObjectManager>(); // bulletPool = FindObjectOfType <BulletPool>(); // missileComponent = GetComponent <Missile>(); // trailRenderer = GetComponent <TrailRenderer>(); // TODO: Esto ahora va en el POOL if (dangerousEnough) { // Instanciamos el trail renderer carolHelp = FindObjectOfType <CarolBaseHelp>(); if (drawTrayectory) { detectionTrail = Instantiate(carolHelp.dangerousProyetilesTrailPrefab, transform.position, Quaternion.identity); detectionTrailRenderer = detectionTrail.GetComponent <LineRenderer>(); // //AllocateTrailRenderer(); } // //carolHelp.TriggerGeneralAdvice("DangerIncoming"); // //bulletPool.AddDangerousBulletToList(gameObject); } }
// Start is called before the first frame update void Start() { explosiveBullet = GetComponent <ExplosiveBullet>(); if (explosiveBullet == null) { Debug.Log(gameObject.name + "should have the ExplosiveBullet component"); } }
public override IBullet Create(Vector where) { ExplosiveBullet bullet = new ExplosiveBullet(BulletAdder, direction, where); ApplyDmgModifier(bullet); ApplyOnHits(bullet); return(bullet); }
protected void SetFormationProyectileStrength(GameObject nextProyectile) { Bullet bullet = nextProyectile.GetComponent <Bullet>(); ExplosiveBullet explosiveBullet = nextProyectile.GetComponent <ExplosiveBullet>(); bullet.Rb.mass = formationWeaponData.proyectile.maxMass * enemyFormation.FormationStrength; if (explosiveBullet) { explosiveBullet.explosiveLoad = formationWeaponData.proyectile.maxExplosiveLoad * enemyFormation.FormationStrength; } }
private void ShootExplosive() { GameObject bullet = Instantiate(weapon.bulletPrefab, bulletSpawnPos.position, Quaternion.identity); ExplosiveBullet explosiveBullet = bullet.GetComponent <ExplosiveBullet>(); explosiveBullet.damage = weapon.damage; explosiveBullet.radius = weapon.radius; bullet.transform.rotation = weaponPivot.transform.rotation; bullet.GetComponent <Rigidbody2D>().AddForce(bullet.transform.right * weapon.bulletSpeed, ForceMode2D.Impulse); }