Пример #1
0
 /// <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;
     }
 }
Пример #2
0
	// Use this for initialization
	void Start () {
		factoryBullet = new FactoryBullet ();
	}
Пример #3
0
	public AIFly(){
		factoryBullet = new FactoryBullet ();
	}
Пример #4
0
 /// <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);
 }