Implemented engine

This commit is contained in:
Ivan Grachyov
2021-11-09 22:32:12 +05:00
parent e2c1c4bc88
commit 8a426a1d5c
7 changed files with 182 additions and 46 deletions

View File

@@ -1,18 +1,20 @@
Gearbox = class("Gearbox")
function Gearbox:initialize(options)
options = options or {}
options = options or {}
self.ratios = options.ratios
self.finalDrive = options.finalDrive
self.ratios = options.Ratios
self.finalDrive = options.FinalDrive
self.reverse = options.Reverse
self._linkedDiffs = {}
self.gear = 0
self.gear = 0
self._linkedDiffs = {}
self._clutch = nil
end
function Gearbox:linkDiff(diff)
table.insert(self._linkedDiffs, diff)
table.insert(self._linkedDiffs, diff)
end
function Gearbox:shift(dir)
@@ -20,9 +22,16 @@ function Gearbox:shift(dir)
end
function Gearbox:setGear(gear)
self.gear = gear
if gear >= -1 and gear <= #self.ratios then
self.gear = gear
end
end
function Gearbox:linkClutch(clutch)
self._clutch = clutch
clutch:linkGearbox(self)
end
function Gearbox:update()
end
end