Пример #1
0
 public void AddProjectile(Projectile proj)
 {
     new_projectiles.Add(proj);
 }
Пример #2
0
        public virtual void SpawnProjectile(float angle )
        {
            Projectile projectile = new Projectile();

            float fire_angle = angle + ship.angle;

            projectile.angle = fire_angle;
            projectile.velocity = ship.velocity + Utility.CosSin(fire_angle, projectile_velocity) + Utility.RandVec(projectile_scatter);
            projectile.life = projectile_frame_life;
            projectile.pos = ship.pos + Utility.Rotate(port.position, ship.angle);

            projectile.sprite = ArtManager.GetSpriteResource(template.projectile_sprite_resource).New();
            projectile.sprite.color = template.projectile_color;
            projectile.sprite.scale = new Vector2(Utility.Sqrt(projectile_scale.X), Utility.Sqrt(projectile_scale.Y) );

            projectile.explosion = explosion;
            projectile.parent = ship;

            ship.universe.AddProjectile(projectile);
        }