/// <summary> /// method call when the weapon should shot. /// if the weapon can shot, create the new bullet using the factory and set the bullet vars ( the direction is the only one for now) /// </summary> public virtual void Fire() { // only if the weapon can shot will do it if (CanShot()) { // create the bullet using the factory Bullet newBullet = FactoryBullet.CreateBullet(bullet, InitialPosition.position); // add the properties, for now only the direccion newBullet.GetComponent <BulletMovement>().BulletDirection = BulletDirection; } }
// Use this for initialization void Start () { factoryBullet = new FactoryBullet (); }
public AIFly(){ factoryBullet = new FactoryBullet (); }
/// <summary> /// implementation of interface IBulletDetector and called from BulletDetetor when a bullet detect a collision /// When a collision is detect, calling the factory bullet to destroy the bullet /// </summary> /// <param name="bullet">bullet to be destroyed ( will be bullet == this )</param> public void BulletCollisionDetected(Bullet bullet) { // calling the factory bullet to destroy the bullet FactoryBullet.DestroyBullet(bullet); }