using UnityEngine; using System.Collections; public interface IDevice { string Name { get; } string ShortDescription { get; } } public interface IElectricDevice : IDevice { void SetPowerBus(PowerBus bus); bool On { get; set; } } public abstract class IElecticEnergySource : MonoBehaviour, IDevice{ public abstract float Voltage{ get; } public abstract float MaxPower{ get; } public abstract string Name{ get; } public abstract string ShortDescription{ get; } } public interface IGear{ float Direction{ get; } float Radius{ get; } float InternalStopMoment{ get; } float ExternalStopMoment{ get; set; } float Torque{ get; } float Rpm{ get; } } public interface IMotor{ } public class GearJoint{ private IGear _a; private IGear _b; private float _ratio; public GearJoint(IGear a, IGear b){ _a = a; _b = b; _ratio = _a.Radius / _b.Radius; } public void Solve(){ //сначала обмениваемся стоп моментами чтобы понять есть ли преодолевшие его движки _b.ExternalStopMoment = (_a.InternalStopMoment / _ratio); _a.ExternalStopMoment = (_b.InternalStopMoment * _ratio); } }