Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
WidowmakerSimulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
15박보승
WidowmakerSimulator
Commits
2172a7b4
Commit
2172a7b4
authored
Oct 13, 2019
by
15박보승
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
플레이어 컨트롤 개선
parent
3badd76d
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
182 additions
and
64 deletions
+182
-64
Player.physicMaterial
Grapplers/Assets/Materials/Player.physicMaterial
+14
-0
Player.physicMaterial.meta
Grapplers/Assets/Materials/Player.physicMaterial.meta
+8
-0
Ingame.unity
Grapplers/Assets/Scenes/Ingame.unity
+90
-28
CameraController.cs
Grapplers/Assets/Scripts/CameraController.cs
+0
-2
IngameUIManager.cs
Grapplers/Assets/Scripts/IngameUIManager.cs
+10
-0
PlayerController.cs
Grapplers/Assets/Scripts/PlayerController.cs
+47
-20
WeaponBehaviour.cs
Grapplers/Assets/Scripts/WeaponBehaviour.cs
+13
-14
No files found.
Grapplers/Assets/Materials/Player.physicMaterial
0 → 100644
View file @
2172a7b4
%YAML
1.1
%TAG
!u!
tag:unity3d.com,2011:
---
!u!134
&13400000
PhysicMaterial
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_Name
:
Player
dynamicFriction
:
1
staticFriction
:
1
bounciness
:
0
frictionCombine
:
0
bounceCombine
:
0
Grapplers/Assets/Materials/Player.physicMaterial.meta
0 → 100644
View file @
2172a7b4
fileFormatVersion: 2
guid: f529349e6ff9028458dcf46cb375eb07
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 13400000
userData:
assetBundleName:
assetBundleVariant:
Grapplers/Assets/Scenes/Ingame.unity
View file @
2172a7b4
...
@@ -582,6 +582,85 @@ CanvasRenderer:
...
@@ -582,6 +582,85 @@ CanvasRenderer:
m_PrefabAsset
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
65539126
}
m_GameObject
:
{
fileID
:
65539126
}
m_CullTransparentMesh
:
0
m_CullTransparentMesh
:
0
---
!u!1
&86845512
GameObject
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
serializedVersion
:
6
m_Component
:
-
component
:
{
fileID
:
86845515
}
-
component
:
{
fileID
:
86845514
}
-
component
:
{
fileID
:
86845513
}
m_Layer
:
5
m_Name
:
DistanceText
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_StaticEditorFlags
:
0
m_IsActive
:
1
---
!u!114
&86845513
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
86845512
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
5f7201a12d95ffc409449d95f23cf332
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
m_Material
:
{
fileID
:
0
}
m_Color
:
{
r
:
1
,
g
:
0
,
b
:
0
,
a
:
1
}
m_RaycastTarget
:
1
m_OnCullStateChanged
:
m_PersistentCalls
:
m_Calls
:
[]
m_TypeName
:
UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData
:
m_Font
:
{
fileID
:
10102
,
guid
:
0000000000000000e000000000000000
,
type
:
0
}
m_FontSize
:
14
m_FontStyle
:
0
m_BestFit
:
1
m_MinSize
:
10
m_MaxSize
:
40
m_Alignment
:
3
m_AlignByGeometry
:
0
m_RichText
:
1
m_HorizontalOverflow
:
0
m_VerticalOverflow
:
0
m_LineSpacing
:
1
m_Text
:
0m
---
!u!222
&86845514
CanvasRenderer
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
86845512
}
m_CullTransparentMesh
:
0
---
!u!224
&86845515
RectTransform
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
86845512
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Father
:
{
fileID
:
1343936104
}
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_AnchorMin
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchorMax
:
{
x
:
0.5
,
y
:
0.5
}
m_AnchoredPosition
:
{
x
:
101.6
,
y
:
0
}
m_SizeDelta
:
{
x
:
160
,
y
:
30
}
m_Pivot
:
{
x
:
0.5
,
y
:
0.5
}
---
!u!1
&87772444
---
!u!1
&87772444
GameObject
:
GameObject
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -12640,7 +12719,6 @@ GameObject:
...
@@ -12640,7 +12719,6 @@ GameObject:
-
component
:
{
fileID
:
1171556386
}
-
component
:
{
fileID
:
1171556386
}
-
component
:
{
fileID
:
1171556389
}
-
component
:
{
fileID
:
1171556389
}
-
component
:
{
fileID
:
1171556384
}
-
component
:
{
fileID
:
1171556384
}
-
component
:
{
fileID
:
1171556385
}
-
component
:
{
fileID
:
1171556383
}
-
component
:
{
fileID
:
1171556383
}
-
component
:
{
fileID
:
1171556390
}
-
component
:
{
fileID
:
1171556390
}
-
component
:
{
fileID
:
1171556391
}
-
component
:
{
fileID
:
1171556391
}
...
@@ -12685,24 +12763,6 @@ MonoBehaviour:
...
@@ -12685,24 +12763,6 @@ MonoBehaviour:
moveDelta
:
{
x
:
0
,
y
:
0
,
z
:
0
}
moveDelta
:
{
x
:
0
,
y
:
0
,
z
:
0
}
maxMagnitude
:
50
maxMagnitude
:
50
ps
:
20
ps
:
20
---
!u!143
&1171556385
CharacterController
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1171556382
}
m_Material
:
{
fileID
:
0
}
m_IsTrigger
:
0
m_Enabled
:
0
serializedVersion
:
2
m_Height
:
2
m_Radius
:
0.5
m_SlopeLimit
:
45
m_StepOffset
:
0.3
m_SkinWidth
:
0.08
m_MinMoveDistance
:
0.001
m_Center
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!23
&1171556386
---
!u!23
&1171556386
MeshRenderer
:
MeshRenderer
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -12757,7 +12817,7 @@ Transform:
...
@@ -12757,7 +12817,7 @@ Transform:
m_PrefabAsset
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1171556382
}
m_GameObject
:
{
fileID
:
1171556382
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
-
10.2
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
-
9.73
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
m_Children
:
-
{
fileID
:
1897959105
}
-
{
fileID
:
1897959105
}
...
@@ -12792,13 +12852,13 @@ CapsuleCollider:
...
@@ -12792,13 +12852,13 @@ CapsuleCollider:
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
1171556382
}
m_GameObject
:
{
fileID
:
1171556382
}
m_Material
:
{
fileID
:
0
}
m_Material
:
{
fileID
:
13400000
,
guid
:
f529349e6ff9028458dcf46cb375eb07
,
type
:
2
}
m_IsTrigger
:
0
m_IsTrigger
:
0
m_Enabled
:
1
m_Enabled
:
1
m_Radius
:
0.5
m_Radius
:
0.5
m_Height
:
3
m_Height
:
2.38
m_Direction
:
1
m_Direction
:
1
m_Center
:
{
x
:
0
,
y
:
0
.5
,
z
:
0
}
m_Center
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&1171556391
---
!u!114
&1171556391
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -17801,7 +17861,7 @@ GameObject:
...
@@ -17801,7 +17861,7 @@ GameObject:
-
component
:
{
fileID
:
1343936106
}
-
component
:
{
fileID
:
1343936106
}
-
component
:
{
fileID
:
1343936105
}
-
component
:
{
fileID
:
1343936105
}
m_Layer
:
5
m_Layer
:
5
m_Name
:
Image
m_Name
:
AimPoint
m_TagString
:
Untagged
m_TagString
:
Untagged
m_Icon
:
{
fileID
:
0
}
m_Icon
:
{
fileID
:
0
}
m_NavMeshLayer
:
0
m_NavMeshLayer
:
0
...
@@ -17817,7 +17877,8 @@ RectTransform:
...
@@ -17817,7 +17877,8 @@ RectTransform:
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalRotation
:
{
x
:
0
,
y
:
0
,
z
:
0
,
w
:
1
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalPosition
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_LocalScale
:
{
x
:
1
,
y
:
1
,
z
:
1
}
m_Children
:
[]
m_Children
:
-
{
fileID
:
86845515
}
m_Father
:
{
fileID
:
1741517732
}
m_Father
:
{
fileID
:
1741517732
}
m_RootOrder
:
0
m_RootOrder
:
0
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
...
@@ -18845,6 +18906,7 @@ MonoBehaviour:
...
@@ -18845,6 +18906,7 @@ MonoBehaviour:
comboText
:
{
fileID
:
1582354879
}
comboText
:
{
fileID
:
1582354879
}
damageText
:
{
fileID
:
968624425
}
damageText
:
{
fileID
:
968624425
}
OutOfMapWarningUI
:
{
fileID
:
204903075
}
OutOfMapWarningUI
:
{
fileID
:
204903075
}
distanceText
:
{
fileID
:
86845513
}
---
!u!114
&1741517729
---
!u!114
&1741517729
MonoBehaviour
:
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_ObjectHideFlags
:
0
...
@@ -19478,17 +19540,17 @@ PrefabInstance:
...
@@ -19478,17 +19540,17 @@ PrefabInstance:
-
target
:
{
fileID
:
-4216859302048453862
,
guid
:
24022008ff631394abed491c25e5b06c
,
-
target
:
{
fileID
:
-4216859302048453862
,
guid
:
24022008ff631394abed491c25e5b06c
,
type
:
3
}
type
:
3
}
propertyPath
:
m_LocalPosition.x
propertyPath
:
m_LocalPosition.x
value
:
0
.003
value
:
0
objectReference
:
{
fileID
:
0
}
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
-4216859302048453862
,
guid
:
24022008ff631394abed491c25e5b06c
,
-
target
:
{
fileID
:
-4216859302048453862
,
guid
:
24022008ff631394abed491c25e5b06c
,
type
:
3
}
type
:
3
}
propertyPath
:
m_LocalPosition.y
propertyPath
:
m_LocalPosition.y
value
:
0
.5
value
:
0
objectReference
:
{
fileID
:
0
}
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
-4216859302048453862
,
guid
:
24022008ff631394abed491c25e5b06c
,
-
target
:
{
fileID
:
-4216859302048453862
,
guid
:
24022008ff631394abed491c25e5b06c
,
type
:
3
}
type
:
3
}
propertyPath
:
m_LocalPosition.z
propertyPath
:
m_LocalPosition.z
value
:
0
.02
value
:
0
objectReference
:
{
fileID
:
0
}
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
-4216859302048453862
,
guid
:
24022008ff631394abed491c25e5b06c
,
-
target
:
{
fileID
:
-4216859302048453862
,
guid
:
24022008ff631394abed491c25e5b06c
,
type
:
3
}
type
:
3
}
...
...
Grapplers/Assets/Scripts/CameraController.cs
View file @
2172a7b4
...
@@ -32,8 +32,6 @@ public class CameraController : MonoBehaviour
...
@@ -32,8 +32,6 @@ public class CameraController : MonoBehaviour
private
void
Update
()
private
void
Update
()
{
{
Debug
.
Log
(
currentY
);
currentX
+=
Input
.
GetAxis
(
"Mouse X"
);
currentX
+=
Input
.
GetAxis
(
"Mouse X"
);
currentY
=
Mathf
.
Clamp
(
currentY
-
Input
.
GetAxis
(
"Mouse Y"
),
-
89
,
89
);
currentY
=
Mathf
.
Clamp
(
currentY
-
Input
.
GetAxis
(
"Mouse Y"
),
-
89
,
89
);
...
...
Grapplers/Assets/Scripts/IngameUIManager.cs
View file @
2172a7b4
...
@@ -39,6 +39,8 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager>
...
@@ -39,6 +39,8 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager>
[
SerializeField
]
[
SerializeField
]
private
Text
OutOfMapWarningUI
;
private
Text
OutOfMapWarningUI
;
[
SerializeField
]
private
Text
distanceText
;
public
void
UpdateTargetLockedUIs
(
Vector3
[]
pos
)
public
void
UpdateTargetLockedUIs
(
Vector3
[]
pos
)
{
{
...
@@ -151,4 +153,12 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager>
...
@@ -151,4 +153,12 @@ public class IngameUIManager : SingletonBehaviour<IngameUIManager>
else
else
OutOfMapWarningUI
.
text
=
string
.
Format
(
"{0:F1}"
,
remainTime
);
OutOfMapWarningUI
.
text
=
string
.
Format
(
"{0:F1}"
,
remainTime
);
}
}
public
void
UpdateDistanceUI
(
float
distance
)
{
if
(
distance
<
0
)
distanceText
.
text
=
""
;
else
distanceText
.
text
=
string
.
Format
(
"{0:F1}"
,
distance
)
+
"m"
;
;
}
}
}
Grapplers/Assets/Scripts/PlayerController.cs
View file @
2172a7b4
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine
;
[
RequireComponent
(
typeof
(
CharacterController
))]
public
class
PlayerController
:
MonoBehaviour
public
class
PlayerController
:
MonoBehaviour
{
{
public
float
distance
=
10.0f
;
public
float
distance
=
10.0f
;
...
@@ -28,7 +27,10 @@ public class PlayerController : MonoBehaviour
...
@@ -28,7 +27,10 @@ public class PlayerController : MonoBehaviour
private
bool
IsGrounded
private
bool
IsGrounded
{
{
get
{
get
{
return
Physics
.
OverlapSphere
(
groundChecker
.
position
,
0.1f
,
groundMask
).
Length
>
0
;
RaycastHit
hit
;
return
Physics
.
SphereCast
(
transform
.
position
,
col
.
radius
/
2
,
Vector3
.
down
,
out
hit
,
col
.
bounds
.
extents
.
y
+
0.5f
,
groundMask
);
//return Physics.Raycast(transform.position, Vector3.down, col.bounds.extents.y + 0.5f, groundMask);
//return Physics.OverlapSphere(groundChecker.position, 0.1f, groundMask).Length > 0;
}
}
}
}
...
@@ -55,9 +57,10 @@ public class PlayerController : MonoBehaviour
...
@@ -55,9 +57,10 @@ public class PlayerController : MonoBehaviour
Gizmos
.
color
=
Color
.
red
;
Gizmos
.
color
=
Color
.
red
;
Gizmos
.
DrawLine
(
transform
.
position
,
Camera
.
main
.
transform
.
forward
.
normalized
*
200
);
Gizmos
.
DrawLine
(
transform
.
position
,
Camera
.
main
.
transform
.
forward
.
normalized
*
200
);
col
=
GetComponent
<
CapsuleCollider
>();
if
(
IsGrounded
)
if
(
IsGrounded
)
Gizmos
.
color
=
Color
.
green
;
Gizmos
.
color
=
Color
.
green
;
Gizmos
.
DrawSphere
(
groundChecker
.
position
,
0.1f
);
Gizmos
.
DrawSphere
(
transform
.
position
+
Vector3
.
down
*
(
col
.
bounds
.
extents
.
y
+
0.05f
)
,
0.1f
);
}
}
#endif
#endif
...
@@ -71,9 +74,6 @@ public class PlayerController : MonoBehaviour
...
@@ -71,9 +74,6 @@ public class PlayerController : MonoBehaviour
movement
=
0.0f
;
movement
=
0.0f
;
animator
=
GetComponentInChildren
<
Animator
>();
animator
=
GetComponentInChildren
<
Animator
>();
//col.enabled = !IsGrounded;
//cc.enabled = IsGrounded;
MaxHealth
=
Health
=
100
;
MaxHealth
=
Health
=
100
;
}
}
private
void
Update
()
private
void
Update
()
...
@@ -83,6 +83,14 @@ public class PlayerController : MonoBehaviour
...
@@ -83,6 +83,14 @@ public class PlayerController : MonoBehaviour
Animate
(
vertical
,
horizontal
);
Animate
(
vertical
,
horizontal
);
RaycastHit
hit
;
if
(!
hook
.
gameObject
.
activeSelf
&&
Physics
.
Raycast
(
transform
.
position
,
Camera
.
main
.
transform
.
forward
,
out
hit
,
700
))
{
IngameUIManager
.
inst
.
UpdateDistanceUI
(
Vector3
.
Distance
(
transform
.
position
,
hit
.
point
));
}
else
IngameUIManager
.
inst
.
UpdateDistanceUI
(-
1
);
if
(
Input
.
GetMouseButtonDown
(
1
))
if
(
Input
.
GetMouseButtonDown
(
1
))
{
{
if
(!
hook
.
gameObject
.
activeSelf
)
if
(!
hook
.
gameObject
.
activeSelf
)
...
@@ -95,16 +103,21 @@ public class PlayerController : MonoBehaviour
...
@@ -95,16 +103,21 @@ public class PlayerController : MonoBehaviour
if
(
IsGrounded
)
if
(
IsGrounded
)
{
{
rb
.
velocity
=
(
horizontal
*
transform
.
right
+
vertical
*
transform
.
forward
).
normalized
*
10.0f
;
//rb.velocity = Vector3.zero;
transform
.
position
+=
(
horizontal
*
transform
.
right
+
vertical
*
transform
.
forward
).
normalized
*
10.0f
*
Time
.
deltaTime
;
//rb.velocity = (horizontal * transform.right + vertical * transform.forward).normalized * 10.0f;
if
(
Input
.
GetButtonDown
(
"Jump"
))
if
(
Input
.
GetButtonDown
(
"Jump"
))
rb
.
velocity
+=
new
Vector3
(
0
,
5
-
rb
.
velocity
.
y
,
0
);
{
rb
.
velocity
=
(
horizontal
*
transform
.
right
+
vertical
*
transform
.
forward
).
normalized
*
5.0f
;
rb
.
velocity
+=
new
Vector3
(
0
,
10
-
rb
.
velocity
.
y
,
0
);
}
}
}
else
else
{
{
if
(
joint
.
enabled
)
if
(
joint
.
enabled
)
joint
.
moveDelta
=
(
horizontal
*
transform
.
right
+
vertical
*
transform
.
forward
).
normalized
*
30.0f
;
joint
.
moveDelta
=
(
horizontal
*
transform
.
right
+
vertical
*
transform
.
forward
).
normalized
*
30.0f
;
else
else
rb
.
AddForce
(
horizontal
*
Camera
.
main
.
transform
.
right
+
vertical
*
Camera
.
main
.
transform
.
forwar
d
*
10.0f
);
rb
.
AddForce
(
(
horizontal
*
transform
.
right
+
vertical
*
transform
.
forward
).
normalize
d
*
10.0f
);
}
}
if
(
MapManager
.
inst
.
IsOutOfMapBounds
(
transform
.
position
))
if
(
MapManager
.
inst
.
IsOutOfMapBounds
(
transform
.
position
))
...
@@ -128,6 +141,20 @@ public class PlayerController : MonoBehaviour
...
@@ -128,6 +141,20 @@ public class PlayerController : MonoBehaviour
}
}
}
}
private
void
FixedUpdate
()
{
/*
if (IsGrounded)
{
RaycastHit hit;
Debug.Log(Physics.Raycast(transform.position, Vector3.down, out hit, groundMask));
Debug.Log(Physics.gravity + " * " + hit.normal + " = " + Vector3.Dot(Physics.gravity, hit.normal));
//Debug.Log(Physics.gravity + Physics.gravity * Vector3.Dot(Physics.gravity, hit.normal));
rb.AddForce(Physics.gravity + Physics.gravity * Vector3.Dot(Physics.gravity, hit.normal));
}
*/
}
private
void
FireHook
()
private
void
FireHook
()
{
{
joint
.
enabled
=
false
;
joint
.
enabled
=
false
;
...
...
Grapplers/Assets/Scripts/WeaponBehaviour.cs
View file @
2172a7b4
...
@@ -24,17 +24,24 @@ public class WeaponBehaviour : MonoBehaviour
...
@@ -24,17 +24,24 @@ public class WeaponBehaviour : MonoBehaviour
private
ParticleSystem
knifeEffect
;
private
ParticleSystem
knifeEffect
;
[
SerializeField
]
[
SerializeField
]
private
LayerMask
enemyMask
,
blockMask
;
private
LayerMask
enemyMask
,
blockMask
;
private
IWeapon
weapon
;
private
IWeapon
weapon
{
get
{
return
weaponList
[
weaponIndex
];
}
}
private
List
<
IWeapon
>
weaponList
=
new
List
<
IWeapon
>();
private
int
weaponIndex
=
0
;
private
void
Start
()
private
void
Start
()
{
{
weapon
=
new
Gun
(
gunDamage
,
gunRange
,
bulletEffect
);
IngameUIManager
.
inst
.
UpdateWeaponTypeUI
(
WeaponType
.
GUN
);
IngameUIManager
.
inst
.
UpdateWeaponTypeUI
(
WeaponType
.
GUN
);
weaponList
.
Add
(
new
Gun
(
gunDamage
,
gunRange
,
bulletEffect
));
weaponList
.
Add
(
new
Knife
(
knifeDamage
,
knifeRange
,
bulletEffect
,
transform
));
}
}
private
void
Update
()
private
void
Update
()
{
foreach
(
var
weapon
in
weaponList
)
{
{
weapon
.
UpdateWeapon
();
weapon
.
UpdateWeapon
();
}
Enemy
[]
hitEnemies
=
weapon
.
WeaponLockOn
(
enemyMask
,
blockMask
);
Enemy
[]
hitEnemies
=
weapon
.
WeaponLockOn
(
enemyMask
,
blockMask
);
weapon
.
UseWeapon
(
hitEnemies
);
weapon
.
UseWeapon
(
hitEnemies
);
...
@@ -50,16 +57,8 @@ public class WeaponBehaviour : MonoBehaviour
...
@@ -50,16 +57,8 @@ public class WeaponBehaviour : MonoBehaviour
private
void
SwapWeapon
()
private
void
SwapWeapon
()
{
{
if
(
weapon
.
GetType
()
==
typeof
(
Gun
))
weaponIndex
=
(
weaponIndex
+
1
)
%
2
;
{
IngameUIManager
.
inst
.
UpdateWeaponTypeUI
((
WeaponType
)
weaponIndex
);
weapon
=
new
Knife
(
knifeDamage
,
knifeRange
,
bulletEffect
,
transform
);
IngameUIManager
.
inst
.
UpdateWeaponTypeUI
(
WeaponType
.
KNIFE
);
}
else
{
weapon
=
new
Gun
(
gunDamage
,
gunRange
,
bulletEffect
);
IngameUIManager
.
inst
.
UpdateWeaponTypeUI
(
WeaponType
.
GUN
);
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment