示例#1
0
    public Projectile SpawnProjectile(ProjectileOptions projectileOptions)
    {
        Projectile newProjectile = pool.GetProjectile();

        newProjectile.Initialize(projectileOptions);
        return(newProjectile);
    }
示例#2
0
 public void Initialize(ProjectileOptions options)
 {
     if (rb2d == null)
     {
         rb2d = GetComponent <Rigidbody2D>();
     }
     transform.position = options.Position;
     transform.rotation = options.Rotation;
     this.lifeTime      = options.LifeTime;
     rb2d.velocity      = options.StartingVelocity;
     rb2d.AddForce(options.Direction * options.Speed, ForceMode2D.Impulse);
     gameObject.tag   = options.Tag;
     gameObject.layer = LayerMask.NameToLayer(options.Layer);
 }