예제 #1
0
파일: Weapon.cs 프로젝트: espenja/spacemas
 public Weapon(Bullet bulletType, float firerate, Player owner)
 {
     BulletType = bulletType;
     Firerate = firerate;
     Owner = owner;
     TimeSinceLastShot = firerate;
 }
예제 #2
0
파일: Player.cs 프로젝트: espenja/spacemas
 public void BulletImpact(Bullet bullet, GameObject Object)
 {
     var enemy = Object as Enemy.Enemy;
     if (enemy != null && enemy.Dead)
     {
         Money += enemy.Bounty;
     }
 }
예제 #3
0
파일: Bullet.cs 프로젝트: espenja/spacemas
 public Bullet(Bullet CopyBullet)
 {
     Listeners = new List<IBulletListener>();
     HealthChange = CopyBullet.HealthChange;
     Effect = CopyBullet.Effect.Clone();
     isVisible = true;
     Texture = CopyBullet.Texture;
     TravelSpeed = CopyBullet.TravelSpeed;
     Scale = 0.4f;
 }
예제 #4
0
파일: Weapon.cs 프로젝트: espenja/spacemas
        public void Shoot(GameTime gameTime)
        {
            TimeSinceLastShot += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            if (!IsDisabled && TimeSinceLastShot >= Firerate)
            {
                Bullet newBullet = new Bullet(BulletType);
                newBullet.Scale = BulletType.Scale;
                newBullet.Velocity = new Vector2((float)Math.Cos(Owner.Rotation), (float)Math.Sin(Owner.Rotation)) * newBullet.TravelSpeed;
                newBullet.Position = Owner.Position + new Vector2((float)Math.Cos(Owner.Rotation), (float)Math.Sin(Owner.Rotation)) * 40f;
                newBullet.Listeners.Add(Owner);
                LevelController lcon = GameServices.GetService<LevelController>();
                lcon.CurrentLevel.AllDrawableGameObjects.Add(newBullet);
                TimeSinceLastShot = 0;

            }
        }
예제 #5
0
파일: Player.cs 프로젝트: espenja/spacemas
        public Player(string name, Vector2 position, Texture2D texture)
        {
            Texture = texture;
            Name = name;
            Rotation = 0.0f;
            Position = position;
            AccelerationRate = 8.0f;
            RotationRate = 8.0f;
            Scale = 0.5f;

            MaxHealthPoints = 1000;
            HealthPoints = MaxHealthPoints;

            Money = 0;

            ContentManager cm = GameServices.GetService<ContentManager>();
            Bullet weaponBullet = new Bullet(-30f, 700f, new DisableEffect(2000f), cm.Load<Texture2D>("Textures/bullet"));
            Weapon = new Weapon(weaponBullet, 100f, this);

            HealthBar = new HealthBar(this);
            PlayerControls = ControlsController.GetControls(this);
        }
예제 #6
0
파일: Player.cs 프로젝트: espenja/spacemas
        public void Reset()
        {
            AccelerationRate = 8.0f;
            RotationRate = 8.0f;
            MaxHealthPoints = 1000;
            HealthPoints = MaxHealthPoints;
            Dead = false;
            Disabled = false;

            Money = 0;

            ContentManager cm = GameServices.GetService<ContentManager>();
            Bullet weaponBullet = new Bullet(-30f, 700f, new DisableEffect(2000f), Weapon.BulletType.Texture);
            Weapon = new Weapon(weaponBullet, 100f, this);
        }