Exemplo n.º 1
0
 void addWeapons(ShipModelComponent component, ShipBonusComponent bonusComponent, Entity e)
 {
     float missileSpawnDelay = bonusComponent == null ? component.missileSpawnDelay : component.missileSpawnDelay * (1.0f - bonusComponent.fireRateBoost);
     float secondaryMissileSpawnDelay = bonusComponent == null ? component.secondaryMissileSpawnDelay : component.secondaryMissileSpawnDelay * (1.0f - bonusComponent.fireRateBoost);
     float damageFactor = bonusComponent == null ? 1.0f : 1.0f + bonusComponent.damageBoost;
     e.AddMissileSpawner(0.0f, (int)((float)component.missileDamage * damageFactor), missileSpawnDelay, ResourceWithColliders.MissilePrimary, new Vector2(0.0f, component.missileVelocity), CollisionTypes.Player);
     if (component.hasSecondaryMissiles)
     {
         List<Entity> children = e.parent.children;
         for (int i = 0; i < children.Count; i++)
         {
             Entity child = children[i];
             if (child.isSecondaryWeapon)
             {
                 child.AddMissileSpawner(0.0f, (int)((float)component.secondaryMissileDamage * damageFactor), secondaryMissileSpawnDelay, ResourceWithColliders.MissileSecondary, new Vector2(0.0f, component.secondaryMissileVelocity), CollisionTypes.Player);
             }
         }
     }
 }
Exemplo n.º 2
0
    public void provide(Entity e, int damage, EnemyModel component)
    {
        damage = (int)(damage * getDamageFactor());

        switch (component.weapon)
        {
            case WeaponTypes.Circle:
                e.AddCircleMissileSpawner(component.amount, damage, component.time, component.spawnDelay, component.weaponResource,
                    component.velocity * getMissileSpeedFactor(), CollisionTypes.Enemy);
                break;
            case WeaponTypes.CircleRotated:
                e.AddCircleMissileRotatedSpawner(component.amount, damage, component.waves, component.angle, component.angleOffset,
                    component.time, component.spawnDelay, component.weaponResource, component.velocity * getMissileSpeedFactor(), CollisionTypes.Enemy);
                break;
            case WeaponTypes.Dispersion:
                e.AddDispersionMissileSpawner(component.time, damage, component.spawnDelay, component.angle, component.weaponResource,
                    component.velocity * getMissileSpeedFactor(), CollisionTypes.Enemy);
                break;
            case WeaponTypes.Home:
                e.AddHomeMissileSpawner(component.time, component.spawnDelay, damage, component.weaponResource, component.velocity * getMissileSpeedFactor(),
                    component.startVelocity, component.followDelay, component.selfDestructionDelay, CollisionTypes.Enemy);
                break;
            case WeaponTypes.Laser:
                e.AddLaserSpawner(0.0f, component.velocity, component.velocity, component.angle, Vector2.up, CollisionTypes.Enemy, damage, component.weaponResource, null);
                break;
            case WeaponTypes.Multiple:
                e.AddMultipleMissileSpawner(component.amount, damage, 0, component.timeDelay, component.delay, component.time,
                    component.spawnDelay, component.weaponResource, component.randomPositionOffsetX, component.startVelocity * getMissileSpeedFactor(), CollisionTypes.Enemy);
                break;
            case WeaponTypes.Single:
                e.AddMissileSpawner(component.time, damage, component.spawnDelay, component.weaponResource, component.startVelocity * getMissileSpeedFactor(), CollisionTypes.Enemy);
                break;
            case WeaponTypes.Target:
                e.AddTargetMissileSpawner(component.time, damage, component.spawnDelay, component.weaponResource, component.velocity * getMissileSpeedFactor(),
                    CollisionTypes.Enemy, CollisionTypes.Player);
                break;
        }
    }
Exemplo n.º 3
0
 public override void Execute(Entity entity, EnemyModel model)
 {
     base.Execute(entity, model);
     entity.AddMissileSpawner(model.time, 0, model.spawnDelay, model.weaponResource, model.startVelocity, CollisionTypes.Enemy);
 }