Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
curvedflats
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
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
Flatland
curvedflats
Commits
f54dd753
Commit
f54dd753
authored
Aug 22, 2019
by
16이진형
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
잡고 다시 놓기
parent
e0b61434
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
62 additions
and
3 deletions
+62
-3
IGrabable.cs
Assets/Scripts/Interface/IGrabable.cs
+1
-0
IGraber.cs
Assets/Scripts/Interface/IGraber.cs
+1
-0
IInteractable.cs
Assets/Scripts/Interface/IInteractable.cs
+1
-0
IInteractor.cs
Assets/Scripts/Interface/IInteractor.cs
+1
-1
GrabableObject.cs
Assets/Scripts/ObjectMovement/GrabableObject.cs
+22
-1
PlayerMovement.cs
Assets/Scripts/ObjectMovement/PlayerMovement.cs
+35
-1
InteractiveObject.cs
Assets/Scripts/ObjectMovement/abstract/InteractiveObject.cs
+1
-0
No files found.
Assets/Scripts/Interface/IGrabable.cs
View file @
f54dd753
...
...
@@ -9,6 +9,7 @@ namespace Assets.Scripts.Interface
public
interface
IGrabable
{
void
OnGrabbed
(
IGraber
graber
);
void
OnDisGrabbed
(
IGraber
graber
);
bool
IsGrabbed
{
get
;
}
}
...
...
Assets/Scripts/Interface/IGraber.cs
View file @
f54dd753
...
...
@@ -9,6 +9,7 @@ namespace Assets.Scripts.Interface
{
public
interface
IGraber
{
void
OnDisGrab
(
IGrabable
grabed
);
void
OnGrab
(
IGrabable
grabed
);
Vector3
GraberV
{
get
;
}
...
...
Assets/Scripts/Interface/IInteractable.cs
View file @
f54dd753
...
...
@@ -10,6 +10,7 @@ namespace Assets.Scripts.Interface
{
void
OnInteract
(
IInteractor
interactor
);
void
OnDisInteract
(
IInteractor
interactor
);
string
InteractType
{
get
;
}
}
}
Assets/Scripts/Interface/IInteractor.cs
View file @
f54dd753
...
...
@@ -9,7 +9,7 @@ namespace Assets.Scripts.Interface
public
interface
IInteractor
{
void
OnInteract
(
IInteractable
interactable
);
void
OnDisInteract
(
IInteractable
interactable
);
IGraber
IsGraber
{
get
;
...
...
Assets/Scripts/ObjectMovement/GrabableObject.cs
View file @
f54dd753
...
...
@@ -28,9 +28,17 @@ public class GrabableObject : InteractiveObject,IGrabable
}
}
public
void
OnDisGrabbed
(
IGraber
graber
)
{
grabbed
=
false
;
v
=
Vector3
.
zero
;
}
public
void
OnGrabbed
(
IGraber
graber
)
{
grabbed
=
!
grabbed
;
grabbed
=
true
;
}
public
override
void
OnInteract
(
IInteractor
interactor
)
...
...
@@ -46,6 +54,19 @@ public class GrabableObject : InteractiveObject,IGrabable
}
}
public
override
void
OnDisInteract
(
IInteractor
interactor
)
{
if
(
interactor
.
IsGraber
!=
null
)
{
graber
=
interactor
.
IsGraber
;
if
(
graber
.
IsGrab
)
{
graber
.
OnDisGrab
(
this
);
OnDisGrabbed
(
graber
);
}
}
}
protected
override
void
FixedUpdate
()
{
...
...
Assets/Scripts/ObjectMovement/PlayerMovement.cs
View file @
f54dd753
...
...
@@ -9,6 +9,8 @@ public class PlayerMovement : FlatlandMovement,IInteractor,IGraber
{
bool
isinertial
=
true
;
bool
isGrab
=
false
;
bool
isInteracting
=
false
;
IInteractable
interactiongObject
;
public
GameObject
background
;
...
...
@@ -53,7 +55,7 @@ public class PlayerMovement : FlatlandMovement,IInteractor,IGraber
if
(
Input
.
GetKeyDown
(
"g"
))
{
OnInteract
(
TryFindClosestInterativeObject
()
);
Interact
(
);
}
}
...
...
@@ -183,6 +185,19 @@ public class PlayerMovement : FlatlandMovement,IInteractor,IGraber
}
//interactor 구현
public
void
Interact
()
{
if
(
isInteracting
)
{
OnDisInteract
(
interactiongObject
);
}
else
{
OnInteract
(
TryFindClosestInterativeObject
());
}
}
public
IGraber
IsGraber
{
get
...
...
@@ -197,9 +212,20 @@ public class PlayerMovement : FlatlandMovement,IInteractor,IGraber
{
return
;
}
interactiongObject
=
interactable
;
interactable
.
OnInteract
(
this
);
}
public
void
OnDisInteract
(
IInteractable
interactable
)
{
if
(
interactable
==
null
)
{
return
;
}
interactable
.
OnDisInteract
(
this
);
}
//충돌
public
override
void
OnCollisionEnterchild
(
Collision
collision
)
{
...
...
@@ -257,6 +283,14 @@ public class PlayerMovement : FlatlandMovement,IInteractor,IGraber
public
void
OnGrab
(
IGrabable
grabed
)
{
isGrab
=
true
;
isInteracting
=
true
;
}
public
void
OnDisGrab
(
IGrabable
grabed
)
{
isGrab
=
false
;
isInteracting
=
false
;
}
public
Vector3
GraberV
...
...
Assets/Scripts/ObjectMovement/abstract/InteractiveObject.cs
View file @
f54dd753
...
...
@@ -11,4 +11,5 @@ public abstract class InteractiveObject : Planemovement, IInteractable
}
public
abstract
void
OnInteract
(
IInteractor
interactor
);
public
abstract
void
OnDisInteract
(
IInteractor
interactor
);
}
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