Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
tetra-tower
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Oenos
tetra-tower
Commits
f3bc76e6
Commit
f3bc76e6
authored
Jan 30, 2019
by
abpo11
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
아이템 및 생명석 하이라이트, e키를 누르면 상호작용으로 먹어짐
parent
40cfe404
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
7 deletions
+120
-7
PlayScene.unity
Assets/Scenes/PlayScene.unity
+5
-0
PlayerController.cs
Assets/Scripts/Characters/PlayerController.cs
+96
-4
InputManager.asset
ProjectSettings/InputManager.asset
+19
-3
No files found.
Assets/Scenes/PlayScene.unity
View file @
f3bc76e6
...
...
@@ -1020,6 +1020,11 @@ Prefab:
propertyPath
:
inventoryManager
value
:
objectReference
:
{
fileID
:
1908917313
}
-
target
:
{
fileID
:
114294925164316638
,
guid
:
3d077a5f727dd1e4780e9265ed26e036
,
type
:
2
}
propertyPath
:
itemLayer.m_Bits
value
:
8192
objectReference
:
{
fileID
:
0
}
m_RemovedComponents
:
[]
m_SourcePrefab
:
{
fileID
:
100100000
,
guid
:
3d077a5f727dd1e4780e9265ed26e036
,
type
:
2
}
m_IsPrefabAsset
:
0
...
...
Assets/Scripts/Characters/PlayerController.cs
View file @
f3bc76e6
...
...
@@ -53,13 +53,18 @@ public class PlayerController : MonoBehaviour
[
SerializeField
]
private
LayerMask
outerwallLayer
;
[
SerializeField
]
private
LayerMask
itemLayer
;
[
SerializeField
]
private
float
ropeDistance
=
0.3f
;
[
SerializeField
]
private
float
rayDistance
;
[
SerializeField
]
private
float
ropeUp
,
ropeDown
;
[
SerializeField
]
private
DroppedItem
lastDropItem
;
private
DroppedLifeStone
lastLifeStone
;
private
float
interaction
;
private
bool
interactionCoolDown
=
true
;
public
PlayerState
playerState
,
previousState
;
void
Start
()
...
...
@@ -73,7 +78,7 @@ public class PlayerController : MonoBehaviour
horizontal
=
Input
.
GetAxis
(
"Horizontal"
);
horizontalRaw
=
Input
.
GetAxisRaw
(
"Horizontal"
);
verticalRaw
=
Input
.
GetAxisRaw
(
"Vertical"
);
interaction
=
Input
.
GetAxisRaw
(
"interaction"
);
if
(
Input
.
GetButtonDown
(
"Jump"
))
{
jump
=
true
;
...
...
@@ -91,7 +96,24 @@ public class PlayerController : MonoBehaviour
rb
.
gravityScale
=
rbAttackGravityScale
;
return
;
}
if
(
GetItemRay
()
==
false
&&
lastDropItem
!=
null
)
{
lastDropItem
.
HighlightSwitch
(
false
);
lastDropItem
=
null
;
}
if
(
interaction
!=
1f
)
interactionCoolDown
=
true
;
if
(
lastDropItem
!=
null
&&
interaction
==
1f
&&
interactionCoolDown
)
{
interactionCoolDown
=
false
;
print
(
lastDropItem
.
PushItem
()+
"냠냠"
);
}
if
(
lastLifeStone
!=
null
&&
interaction
==
1f
&&
interactionCoolDown
)
{
interactionCoolDown
=
false
;
lastLifeStone
.
ApplyLifeStone
();
print
(
"생명석 냠냠"
);
}
if
(
isGrounded
)
isJumpable
=
true
;
if
(
playerState
!=
PlayerState
.
Attack
)
...
...
@@ -248,6 +270,76 @@ public class PlayerController : MonoBehaviour
return
(
hit1
.
collider
!=
null
||
hit2
.
collider
!=
null
||
hit3
.
collider
!=
null
||
hit4
.
collider
!=
null
||
hit5
.
collider
!=
null
||
hit6
.
collider
!=
null
)
&&
rb
.
velocity
.
y
==
0
;
//플랫폼 점프 버그 방지
}
bool
GetItemRay
()
{
RaycastHit2D
hit1
=
Physics2D
.
Raycast
(
transform
.
position
+
new
Vector3
(
Player
.
X
/
2f
*
0f
,
0
,
0
),
Vector2
.
down
,
rayDistance
,
itemLayer
);
// RaycastHit2D hit2 = Physics2D.Raycast(transform.position - new Vector3(Player.X / 2f, 0, 0), Vector2.down, rayDistance, itemLayer);
Debug
.
DrawRay
(
transform
.
position
+
new
Vector3
(
Player
.
X
/
2f
*
0f
,
0
,
0
),
rayDistance
*
Vector2
.
down
,
Color
.
white
);
if
(
hit1
.
collider
!=
null
)
{
DroppedItem
temp
=
hit1
.
collider
.
GetComponent
<
DroppedItem
>();
DroppedLifeStone
stoneTemp
;
if
(
temp
==
null
)
{
stoneTemp
=
hit1
.
collider
.
GetComponent
<
DroppedLifeStone
>();
if
(
lastLifeStone
!=
stoneTemp
)
{
if
(
lastLifeStone
!=
null
)
{
lastLifeStone
.
HighlightSwitch
(
false
);
}
lastLifeStone
=
stoneTemp
;
stoneTemp
.
HighlightSwitch
(
true
);
}
}
else
if
(
lastDropItem
!=
temp
)
{
if
(
lastDropItem
!=
null
)
{
lastDropItem
.
HighlightSwitch
(
false
);
}
lastDropItem
=
temp
;
temp
.
HighlightSwitch
(
true
);
}
}
/*else if(hit2.collider != null)
{
DroppedItem temp = hit2.collider.GetComponent<DroppedItem>();
DroppedLifeStone stoneTemp;
if (temp == null)
{
stoneTemp = hit2.collider.GetComponent<DroppedLifeStone>();
if (lastLifeStone != stoneTemp)
{
if (lastLifeStone != null)
{
lastLifeStone.HighlightSwitch(false);
}
lastLifeStone = stoneTemp;
stoneTemp.HighlightSwitch(true);
}
}
else if (lastDropItem != temp)
{
if (lastDropItem != null)
{
lastDropItem.HighlightSwitch(false);
}
lastDropItem = temp;
temp.HighlightSwitch(true);
}
}*/
return
hit1
.
collider
!=
null
;
}
bool
IsInRope
()
// Is player in rope?
{
RaycastHit2D
hit1
=
Physics2D
.
Raycast
(
transform
.
position
+
ropeUp
*
Vector3
.
up
,
Vector2
.
right
,
ropeDistance
,
ropeLayer
);
...
...
ProjectSettings/InputManager.asset
View file @
f3bc76e6
...
...
@@ -278,13 +278,29 @@ InputManager:
axis
:
0
joyNum
:
0
-
serializedVersion
:
3
m_Name
:
Submit
m_Name
:
interaction
descriptiveName
:
descriptiveNegativeName
:
negativeButton
:
positiveButton
:
e
altNegativeButton
:
altPositiveButton
:
gravity
:
1000
dead
:
0.001
sensitivity
:
1000
snap
:
0
invert
:
0
type
:
0
axis
:
0
joyNum
:
0
-
serializedVersion
:
3
m_Name
:
Cancel
descriptiveName
:
descriptiveNegativeName
:
negativeButton
:
positiveButton
:
e
nter
positiveButton
:
e
scape
altNegativeButton
:
altPositiveButton
:
space
altPositiveButton
:
joystick button
1
gravity
:
1000
dead
:
0.001
sensitivity
:
1000
...
...
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