// ENTITIES
public class ArmourPowerupEntity : Entity, IModelledEntity {
private const float DEFAULT_ARMOUR_SCALING = 1f;
public ArmourPowerupEntity(Vector3 powerupPosition)
: this(powerupPosition, DEFAULT_ARMOUR_SCALING) { }
public ArmourPowerupEntity(Vector3 powerupPosition, float customScaling) {
this.SetModel(ModelDatabase.ArmourModel);
this.SetPosition(powerupPosition);
this.SetScaling(customScaling);
}
}
public class RocketProjectileEntity : Entity, IModelledEntity, IAudibleEntity {
public RocketProjectileEntity(Vector3 firingPoint, Vector3 firingVelocity, bool isBigRocket) {
this.SetModel(ModelDatabase.RocketModel);
this.SetPosition(firingPoint);
this.SetVelocity(firingVelocity);
this.SetScaling(isBigRocket ? 2f : 1f);
this.SetSound(SoundDatabase.RocketSound);
this.SetSoundRadius(1000f);
}
}
// ELSEWHERE ...
public void FireRocket(Vector3 playerPosition, Vector3 playerAimDirection, bool isHyperspeedRocket) {
float rocketSpeed = isHyperspeedRocket ? 10f : 100f;
RocketProjectileEntity rocketProjectile = new RocketProjectileEntity(playerPosition, playerAimDirection.WithLength(rocketSpeed), false);
if (isHyperspeedRocket) {
rocketProjectile.SetSound(SoundDatabase.HyperspeedRocketSound);
rocketProjectile.SetSoundRadius(2000f);
}
}
Code snippet taken from "Simulating Multiple Inheritance In C#".