-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/Can335/shooter-game
- Loading branch information
Showing
9 changed files
with
935 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
local types = require(script.Parent.types) | ||
|
||
local Gun = {} | ||
Gun.__index = Gun | ||
|
||
function Gun.new(): types.Gun | ||
local self = setmetatable({}, Gun) | ||
|
||
return self | ||
end | ||
|
||
return Gun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local types = require(script.Parent.Parent.types) | ||
|
||
local Arms = {} | ||
Arms.__index = Arms | ||
|
||
type _Arms = types.Arms & { | ||
model: Model, | ||
gun: types.Gun, | ||
} | ||
|
||
function Arms.new(model: Model, gun: types.Gun) | ||
local self = setmetatable({ | ||
model = model, | ||
gun = gun, | ||
}, Arms) | ||
|
||
return self | ||
end | ||
|
||
function Arms.Update(self: _Arms) | ||
end | ||
|
||
return Arms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
local currentCamera = workspace.CurrentCamera | ||
|
||
local types = require(script.Parent.types) | ||
local Arms = require(script.Arms) | ||
|
||
local Viewmodel = {} | ||
Viewmodel.__index = Viewmodel | ||
|
||
type _Viewmodel = types.Viewmodel & { | ||
arms: types.Arms, | ||
} | ||
|
||
--TODO: Accept the 5 weapon slots. | ||
function Viewmodel.new(viewmodel: Model, gun: types.Gun): types.Viewmodel | ||
local model = viewmodel:Clone() | ||
model.Parent = currentCamera | ||
|
||
local self = setmetatable({ | ||
model = model, | ||
arms = Arms.new(model, gun), | ||
}, Viewmodel) | ||
|
||
self:Enable() | ||
|
||
return self | ||
end | ||
|
||
function Viewmodel.Enable(self: _Viewmodel) | ||
self.model:PivotTo(currentCamera.CFrame) | ||
end | ||
|
||
function Viewmodel.Update(self: _Viewmodel) | ||
self.model:PivotTo(currentCamera.CFrame) | ||
self.arms:Update() | ||
end | ||
|
||
return Viewmodel |
File renamed without changes.
Oops, something went wrong.