static void Main(string[] args) { Car car = new Car(); IDriver driver = (IDriver)car; IMechanical mechanical = (IMechanical)car; driver.Drive(); mechanical.Maintain(); DriveACar(car); MaintainCar(car); }
public Material(float noise) { Noise = noise; AcousticProperties = new Acoustic(); AtomicProperties = new Atomic(); ChemicalProperties = new Chemical(); ElectricalProperties = new Electrical(); EnvironmentalProperties = new Environmental(); MagneticProperties = new Magnetic(); ManufacturingProperties = new Manufacturing(); MechanicalProperties = new Mechanical(); OpticalProperties = new Optical(); RadiologicalProperties = new Radiological(); ThermoDynamicsProperties = new ThermoDynamics(); float input_start = -1; float input_end = 1; float output_start = 0; float output_end = 256 * 256 * 256; double output; double slope = 1.0 * (output_end - output_start) / (input_end - input_start); output = output_start + slope * (Noise - input_start); float Positive = Noise.Spread(-1, 1, 0, 1); float r = Voxel.GetRed(Positive); float g = Voxel.GetGreen(Positive); float b = Voxel.GetBlue(Positive); float a = Voxel.GetAlpha(Noise); PhysicalMaterial = new PhongMaterial { DiffuseColor = new Color4(r, g, b, a) }; }
//自動車をメンテナンスする static void MaintainACar(IMechanical car) { //car.Drive(); car.Maintain(); }
static void MaintainCar(IMechanical mechanical) { mechanical.Maintain(); }
static void MaintainACar(IMechanical im) { im.Maintain(); }