コード例 #1
0
ファイル: CarEngine.cs プロジェクト: SGushchin/Deadman-Race
        public float GetTorque(CarFuelTank fuelSource, float traveledDistance)
        {
            var result = 0f;

            if (_descriptionIsNull)
            {
                return(result);
            }

            switch (fuelSource.CurentFuelType)
            {
            case FuelTypes.Good:
                result = _description.Power;
                break;

            case FuelTypes.Medium:
                result = _description.Power * _description.ReducePowerByFuel;
                break;

            case FuelTypes.Bad:
                result = _description.Power * _description.ReducePowerByFuel;
                break;

            default:
                break;
            }

            return(result);
        }
コード例 #2
0
        public MotionModel(Transform car, CarTemplate model)
        {
            _model       = model ?? throw new System.NullReferenceException("[CarController] CarTemplate is null");
            _modelIsNull = false;

            _transform = car;

            _rigidbody = _transform.GetComponentInChildren <Rigidbody>();

            _carcase = _transform.GetComponentInChildren <CarCarcase>();

            _engine = _transform.GetComponentInChildren <CarEngine>();

            _fuelTank = _transform.GetComponentInChildren <CarFuelTank>();

            _wheels = _transform.GetComponentsInChildren <CarWheel>();

            InitializeStandartAssetVariables();
        }